Same issue... you escape out of PHP mode and then output an HTML comment plus a line break.
This is one of the reasons I strongly recommend people to separate out all (or almost all) HTML from their PHP scripts. You're going to have to go through your script and remove any line breaks, comments, spaces, etc. that are outside of the <?php .. ?> tags.
Why do you escape out of PHP mode so often anyway? It does nothing but clutter up the code and, as you can see, cause errors.