This should work:
*function* allGroupNames X
*-- returns all groups for id X*
*repeat* with i = 1 to the number of groups of X
*put* the short name of of *group* i of X & cr after R
*end* *repeat*
*return* R
*end* allGroupNames