How to append the new group to the existing AllowGroups line in /etc/ssh/sshd_config

HI Experts,

I would like to append the new group to the existing AllowGroups in /etc/ssh/sshd_config file without disturbing the existing group. I tried with lineinfile module but unfortunately its failing or overwriting existing groups. Can anyone please provide the clue on logic?

existing setup:

grep AllowGroups /etc/ssh/sshd_config

AllowGroups x y z

required setup: let’s assume “a” is new group, then i am looking as below

grep AllowGroups /etc/ssh/sshd_config

AllowGroups x y z a <-----group “a” needs to be added at the end of the line

Once again thanks for your help

Regards,
Suresh