If you want to transfer output to file, use >, then the filename of the file.

echo This message is in a file named HELLO.txt>HELLO.TXT 

If the file HELLO.TXT doesn’t exist, it creates the file first then stores its output inside.

By doing so, it overwrites the file.
We can prevent this by applying >> instead, which can be used to write entire lines in a file.

echo This is the first line in a file named LINES.TXT>>LINES.TXT
echo This is the second line in a file named LINES.TXT>>LINES.TXT
echo This is the third line in a file named LINES.TXT>>LINES.TXT