writeData to file