import os ls=os.linesep while True: fname=input("fname>>>") if os.path.exists(fname): print('ERROR %s is exist '% fname) continue else: pass break all=[] print("\n Enter") while True: entry =input(">") if entry=='.': break else: all.append(entry) fobj=open(fname,'w') fobj.writelines(['%s%s'%(x,ls) for x in all]) fobj.close() print('END')