Using python to write specific lines from one file to another file,f.write('foo')