Normally, when you want to redirect (standard) output of a script to a file, you run it with a redirection, like:

$ ./ > out.log

However – you can also accomplish the same from inside the script by using exec. The following will write “Test” and then current time into /tmp/out.log”

exec >/tmp/out.log
echo Test

You can find more information about exec on tldp.