write result in file