There may be multiple reason why you want to create a text file in batch. But whatever the reason may be, this is how you do it.

If you want to overwrite an existing text file use >. Example:

@echo off
echo info to save > text.txt

But if you want to append text to an already existing text file use >>. Example:

@echo off
echo info to save >> text.txt

If you need to save multiple lines of text to a file use ()>text.txt Example:

@echo off
(echo username
 echo password)>text.txt