ECHO Hi %1 > test.txt
ECHO Bye %1 >> test.txt
The %1 substitutes the text following the batch file name into the batch file, if the name of the batch file is TEST.BAT, you'd type:
TEST MYNAME
and MYNAME would be substituted for the %1 in the above statements.