This more specific type of question is the kind of thing that we are more willing to answer. If you cannot generate more than 2 waveforms at a time, it likely means that your approach is likely to be the wrong one (not useful in practice) One likely reason is because your approach is running in sequence with everything else in the processor which means this approach will not work in a real application where the processor has to be doing other things. But if you are getting these examples off the net, they cannot all be wrong so the other possibility is you don't understand their approach well enough to expand on it (which will be the case if you are just copying and pasting their code).
Using a hardware peripheral like a timer interrupt to generate the PWM is the most straightforward method. One for each PWM is best, but if you don't have enough, a single timer interrupt can be made to handle multiple signals shuffling in the appropriate interrupt value every time the interrupt fires. To know which interrupt value needs to trigger next, you need to examine all your signals. The interrupt routine also has to know the value that triggered it since it must behave differently for each value since each value is for a different signal.