Take out the username initials and group RG data using initials

Hello bubblers,
I have list of users which we get in API response. So now in custom state i store their list of usernames. I want to group users in RG using their initials. So here is what i was trying :

username list is properly set in custom state.
But when i try to do initials for each username it just stores first item username initial.

Can someone help me with this? how to store initials and group the users in repeating group on basis of a initials.