It sounds like you want to add an existing user to another group. Use usermod to do that -
usermod -a -G ubuntu www-data The change will be in the /etc/group file. You can check it with id www-data and groups Ubuntu commands. Also, use the upper-case G, or you will replace the existing primary group.