Am I able to use code to change how the teams are set?

after making the trigger how do i go about making sure the team selection is how i need it? not sure how this associates the teams