Its this line
$strdone = ($group.name),’,',$membercount
that’s causing the problem. You need to concatenate the two strings so either use
$strdone = ($group.name) + ‘,’ + $membercount
OR
$strdone = “$($group.name),$membercount”
A comma won’t concatenate you strings. The data is being treated as an array of strings which why you are getting the data split across multiple lines