That code could be for use on a Linux system
It would help if the OP would indicate what OS he has.
resdir='/opt/mydir1/client/13.01/mydir2/commandline'
echo $resdir > /usr/me/myfile.txt
The contents of myfile.tx was already assigned to a variable, resdir .
The question does not make sense.
Unix allows the assignment with a set command: ( all that is needed is var=value )
resdir='/opt/mydir1/client/13.01/mydir2/commandline'