Generally speaking, there should not be issues with writing beyond the given space/lines as long as this does not extend to the specified borders. Consider the following example:
Should an answer require more than the given lines, the student is able to write beyond that space, for instance, above, next to and/or under the "End of Question 21".
However, it is also important to note that the given lines usually indicate the expected length of response, meaning that this is something that you may necessarily need to worry about.
Depending on the subject, you may also be given extra writing space in the exam paper itself should you need it and/or you may be able to request extra writing booklets if needed.
I hope this helps!