Import-Module ActiveDirectory
Get-ADUser -SearchBase "OU=contoso users,OU=SBG,DC=contoso,DC=com" -Filter * | foreach-object {
$User = $_.Name
Get-ADPrincipalGroupMembership $_.SamAccountName | Select @{N="User";e={$User}},@{N="User";e={$_.Name}}
} | export-csv -notypeinformation c:\temp\listall.csv
Export-csv won’t accept any objects with out property name
Anyway, if you want to export to csv it's better to use Export-Csv instead of Out-File.
And if you're printing to a text file, I would use echo instead of write-host.
HTH,
Dan