in reply to appending xml to string

You should put explicit quotes around the heredoc terminator:
$mystring .= <<'START'; ... START
If you need to interpolate in the heredoc, use double quotes.

Phil