redirecting the output of a script to a file