for example this script gives me the list of groups but each group is in a line
for group in `groups`                                                                                                   do
        echo "$group,"
done
The objective is to put them like this :group1,group2,group3. Instead of :
group1,
group2,
group3