updated write dict into a file