I saw below scripts in https://community.atlassian.com/t5/Adaptavist-questions/Scriptrunner-bulk-adding-users-to-Group/qaq-p/1001884 which I believe will help you to get started.
I have tested the same script with Jira 8.15 and ScriptRunner 6.19 and able to get it working.
Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events