but this code worked for the testing I did.
What was your test exactly? Did you try it on the OP's original 'hello' example? The code doesn't work, and there are two reasons for that:
1.
%alpha2 = $+(%alpha2,$mid(%alpha1,%c,1),$chr(32)) doesn't work because
you cannot append a single space to a variable. This works however:
%alpha2 = %alpha2 $mid(%alpha1,%c,1)2.
$remove(%alpha1,32) should be
$remove(%alpha1,$chr(32))