Create a user and add them to the sudo group
The user must exist before adding them to the sudoers.
For a script, prefer the lower level tools that are useradd, groupadd, and usermod. For instance, to modify an already existing user and add them to the sudo group:
Obviously, don’t type sudo if you run these commands as root.