Remove and insert lines in a text file,outfile.write(line)