If you want to enclose one string inside another string, you will need to use 'double' quotes on the second string.
Like so:
"_x setunitpos
""UP
""" foreach groupmember
The bold quotes take care of the second string, the normal quotes take care of the first (or outer) string.
Another (maybe easier ;D) way, is to implement the braces that BIS bought in with resistance... eg.
"_x setunitpos
{UP
}" foreach groupmember
OFP sees them as either single or double quotes, depending on the context they are in. Quite useful really