You need to replace $group_id with the ID of the group you want to assign users to.
I have not tested the code when inviting members as a non-admin. That might be a limitation. There is an optional is_confirmed argument that can be submitted with groups_invite_users. Maybe, setting it to true helps in such cases.