Dump Group membership where

I’ve been tasked with what I thought was a fairly straightforward task, even for me!:

For each of the usernames in this spreadsheet, get me a list of the AD groups that start with C_ that each user is a member of.
Here's what I've been cobbled together:
$list = Get-Content C:\a\users.txt

foreach ($account in $list)


    $currentUser = Get-ADUser $account -Properties *

    $groupMembership = (($currentUser.memberof).Name | Where-Object -property Name -Like "C_*"| ForEach-Object {(Get-ADGroup $_).Name;}) -join ','

    $output = @{

                    CitrixUsername = $currentUser.samAccountName

                    Groups = $groupMembership



    $file = New-Object psobject -Property $output

    $file | Export-CSV -Path C:\a\test.csv -Encoding ASCII -Append

My CSV file just has the usernames, not the groups. If I take this part of the pipeline out I get a list of all of the groups:
Where-Object -property Name -Like "C_*"
I believe the problem has to do with the fact that the object in the pipeline is a string at this point, but I'm at a total loss at how to fix it. What am I missing here?