a_list = ["abc", "def", "ghi"]
f = open("a_file.txt", "w")
for item in a_list:
f.write(item + "
")
f.close()
data = [1,2,3,4,5]
with open('myfile.txt', 'w') as f:
f.writelines([f"{x}
" for x in data])
with open('your_file.txt', 'w') as f:
for line in lines:
f.write(f"{line}
")