Write result in a file