Long text field overflow error

Hello people
I have a text field that through java srcipt line breaks are added (<‘br’>)
This produces errors in the overflow, after a certain page, the overflow begins to rise one line and comes to be positioned in the master page.
Some data:
1 when the text is short (it occupies few pages it does not make the error)
2 when I don’t insert the <‘br’> it doesn’t make the error and the overflow is ok
3 I add the text inside the <‘p’> tag
4 we have used different fonts and sizes
5 I have noticed that what is uploaded is the entire block of text, since the text does not reach the lower limit of the master page.

when I don’t add the line break, everything ok:

thank you very much to all.
regards!

Could you share your template with some sample data?