Log output of a script to a file