add functions to write double type array to a file