How are you displaying the file when you are seeing those rectangular characters? Rectangular boxes are unprintable characters. You can check what they are by
B4X:
nstr = ""
For i = 0 to Strlen(Str) - 1
nstr = nstr & Asc(StrAt(Str, i) & " "
Next
Msgbox(nstr)
A line break should be 13 (Cr) followed by 10 (Lf)