You have to overwrite the entire line. Either you already have the full line ready to be written over the old one or you need to read the old data into a variable , make the addition, then write over the old line. There isnt a simple way to traverse the files unfortunately. If you have a lot of data to store its best to make it all organized in one dictionary per file. Dictionaries in dictionaries. …in dictionaries