Sure, what have you tried where are you stuck?
We’re happy to help but not a script writing service.

so just this would not be good enough?

Get-ADPrincipalGroupMembership $username |
Where-Object {$_.GroupCategory -eq 'Security' } |
Select-Object name

If you post code, please use the ‘Insert Code’ button. Please and thank you!