First off, I don't see you opening the file in write mode. You need to check the @Error that should hold the %errorlevel% of the SHELLed command. Alternately if %errorlevel% is not captured, you could redirect the STDERR to a file directly. See the FAQ for info on SHELL, RUN, STDOUT, and STDERR.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.