Most versions of DOS do not have an echo command that will supress newline. This means that any echo command will automatically move to the next line.
You can create your own version of echo that supresses newline with the following command
ECHO ,8P_,FPZ0U]0U[,B0EWP_[SCYQ2M@I~E5@@O!A>%temp%.\echoit.com
This creates a quick assembly file called echoit.com in your %temp% directory.
Then change your commands that use echo command to use echoit instead. So something like
@ECHO OFF
ECHO ,8P_,FPZ0U]0U[,B0EWP_[SCYQ2M@I~E5@@O!A>%temp%.\echoit.com
%temp%\echoit %varname% ;>> logfile
copy x Y >> logfile
del %temp%.\echoit.com ;Delete the program when we are done with it.
You don't have to create and delete the file each time. You could just make it once but then your batch would be specific to the one machine that has echoit.com on it.