How to create a number of things according to the number of elements contained in a text list

I am developing an app for the publication and registration of sports tournaments and I have the following problem:

There are 3 categories in which it is possible to register a team, namely:

Advanced
Intermediate
Beginner

A team can register a squad of players only in one of these categories or it can register a squad for each category (3 squads registered in total).

My problem comes next:

I have a checkout page where the user indicates the categories in which he will register his team and according to that, he will have a discount on the registration. The problem is that if the user selects more than 1 category, it generates a “Registration” thing that has a list of text where the registered categories are indicated, very well, BUT THERE SHOULD BE CREATED 3 THINGS “TEMPLATES”, and each one should contain in its respective “category” field, only 1 category. How can I achieve this?

Exm:

User wants to register 1 template for the advanced category and 1 for the beginner category.

One thing Registration should be created in which the field “registered categories” contains as text list “Advanced and Beginner”.

But 2 things “templates” should be created

Template 1, level: Advanced
Template 2, level: Beginner

Did I understand? I think I need to work on the BACKEND API but I am not sure how to get as many templates created as the number of categories registered and also that each template contains the unique name of each category.