Save data to a file