How to write into a Log file from the batch file?

Using > and >> outputs to a file.

eg

echo Hello World > hi.txt

Will result in a file called hi.txt containing the string "Hello World"

echo How are you >> hi.txt

Will add the line "How are you" to the end of hi.txt

This works on both Windows and Unix based OS. (Linux, Mac OS...)

On windows, using %TIME% or %DATE% in the echo string will output time/date as part of the string.