add read and write file function for contact