so if i understand correct you want a file with on each line:
groupname1-location1
groupname2-location2

?
If so I think you need to:
loop all SU entities
check if entity is group
if so:
get the name
get the location info
store those in a array [[name,location],[name,location],[name,location]] or hash
end of loop
then put the array in a file with File.open

Something like that i think