echo adds a line feed, try this instead
<nul set/p z=a>1.txt OR cd|set/p="a">1.txt
<nul set/p z=a>1.txt
OR
cd|set/p="a">1.txt
Second method requires double quotes, and you can place a variable in place of a.
Note that both methods set ERRORLEVEL to 1.