When I tested my system it works..but when the job is configured to scheduler its bombing and not writing the time
And you didn't think that the fact that the problem only appears when running it from the scheduler was important enough to mention in your original post?
It sounds like you haven't isolated the problem then.
Try adding verbose debugging output to the script that is being run as a scheduled task and see what it is doing, then reproduce the problem with a working example that demonstrates the problem.