write result to .txt file