Moodle allows instructors to put students in groups to facilitate collaboration or discussion.
Select Participants from the menu on the left side of your screen.
From the settings menu select Users then Groups.
Click Create Group.
Give the group a name (1). If desired you can also add a description and profile picture for the group. Click Save Changes (2).
To add members, select the group and click Add/remove users.
Add or remove members from the group as desired by highlighting the desired user (1) and then clicking Add or Remove (2).
Repeat steps 1-6 to create each group that you need.