Write data into file