An alternative but less general question would be: How to use
groupmod based on a group id?
man groupmod indicates a group can only be looked up by group name. This is seemingly a problem for groups that only have an id and not a name, see group with id == 999 below:
~$ id uid=1000(brandon) gid=1000(brandon) groups=1000(brandon),999