I have a txt file of records that I have converted into a dictionary. How can I write this dictionary back to the txt file after appending/replacing the values of the dictionary keys?