write to file instead of stdout