add read/write file function
format output file