#! /usr/bin/env python3 def write_into_files(path, lines): with open(path, 'w') as outfile: for line in lines: print(line, file=outfile) pass lines = ["Das ist ein zeichen", "Das ist ein zweites zeichen0000"] lines.append("Next line") write_into_files("/tmp/test.txt", lines)