write data to .txt file