You need to add a newline to the front of newline
:
file_out.write("\n" + newline)
Otherwise, Python will write the text to the end of the last line in the file.
Keep in mind too that you added a newline to the end of newline
here:
newline = " ".join([str(e) for e in line]) + "\n"
# ^^^^
This means that, when you run your code, a blank line will be added to the end of the file. I think you might want to remove this newline:
newline = " ".join([str(e) for e in line])