The following works as expected.
awk -F'^' '{printf "set %s:%s %s\n",$1,$2, $7}' todel.txt | sed 's/$/\\r\\n/' >> tofile.txt
But when I try to add a variable to output as shown below, I get an error:
awk -F'^' '{printf "set %s:%s:%s %s\n",$1,$2,$myvar $7}' todel.txt | sed 's/$/\\r\\n/' >> tofile.txt