Fixed output of list comprehension version to .writelines