write data into file