2nd approach,
Why not use /n for newline, and include the newline within the string that you are joining....
You've not included the newline within the concatenate string and that is probably why it's out of sequence
Note... I've not tried the above before... But interested in the approach