Number of repetitions

I need to create a function that allows me to indicate the number of repetitions at the time of scheduling an appointment, and I don’t know where to start, I have reviewed add_edit_event.php, but I cannot identify where to insert the for cycle so that I create the number of indicated appointments, and automatically indicate the end date.

Another emr solution have this feature.