Implement write result to file