[python] how to add lines to existing file using python