FOR is capturing the CLS in math.bat. The unexpected symbol is a form feed (FF) character. CLS sends an FF character - ASCII (decimal) 12 (hex) 0C - to the console. As the FOR command is capturing the output stream of Math.bat I suppose it is getting prepended to the intended string from the echo %result% command at the end of Math.bat. I tested this by creating another batch with only a CLS command in it and processing that after Math.bat and appending the result to Output.txt. In fact parsing a bare CLS command in FOR does the same thing. See below.
I imagine this is happening because the behaviour of FOR with the /F switch is to treat the dataset (the part in the brackets) as a series of lines to be processed. What you are doing is running Math.bat invisibly and parsing the output line by line, assigning the value of %%F in turn to the variable %result%. You would imagine that Math.bat has only one line of output. Now you would expect that when you exit the loop, that %result% would hold the contents of the last (final) (in this case the only) line processed by FOR /F.You could have a hundred ECHO HELLO WORLDs in Math.bat before the line which echoes %result% and FOR /F will dutifully see them, assign them to %%F and dump each one when the next line is read. So when you exit the loop only the final value of %%F is in %result%.
What I think is the reason for the behaviour is that unlike a normal command, CLS does not send a newline to the console so FOR does not discard the FF character it picks up.
I am not sure if you would call this a bug, exactly, more a feature, maybe.
Possible workarounds:
1. Since FOR /F processes batch file and program output text streams invisibly, then a CLS in a batch file designed to be so processed is a waste of space. It won't clear anything. So take 'em out.
2. If you must have a CLS in such a batch file for some reason, put an echo. after it so that FOR /F sees a new line.
A couple of personal style preferences which you are free to ignore:
3. In general, as I progressed in batch scripting I tended not to sprinkle CLS commands into my scripts.
4. Also a sign of a beginner is randomly placed @ characters starting lines when you already have @echo off at the top of the script (it says "copied-and-pasted" quite loudly!)
a. My Input.bat
@echo off
set envpath=%~dp0
set /p var1=Enter a number-
set /p var2=Enter another number-
for /f "tokens=*" %%F in ('Math.bat %var1% %var2%') do set result=%%F
echo Sum= %result% >Output.txt
for /f "tokens=*" %%G in ('MY-CLS.bat') do set result=%%G
echo Output of cls.bat= %result% >> output.txt
for /f "tokens=*" %%H in ('CLS') do set result=%%H
echo Output of cls command=%result% >> output.txt
echo.
echo This is output.txt:
type output.txt
b. My MY-CLS.bat
@cls
c. Output: (can you see the ♀ characters?)
Enter a number-5
Enter another number-5
This is output.txt:
Sum= ♀10
Output of cls.bat= ♀
Output of cls command=♀