2 pins at the same time

So i got this program and it works fine. It is supposed to generate a pwm signal of a predetermined frequency by using a function.
The downside however is that i can only run this function on one pin at a time. How can i get it to start and finish on 2 pins simultaneously (for example pin 10 and 11)?
For my project i need 4 pins to run in pairs (with delays between the pairs)

void frecventa(byte targetPin, int highRate, int lowRate, int n) 
/* targetPin=nr of pin used
   highRate=High state duration
   lowRate=Low state duration
   n=number of repeats*/
{
   
    for (int i=0; i < n; i++)
    {
    digitalWrite(targetPin, HIGH);   
    delay(highRate);                     
    digitalWrite(targetPin, LOW);    
    delay(lowRate);
  }
}

void setup() {
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
}

void loop() {
frecventa(9,16,16,70);
delay(2000);
frecventa(10,16,16,70);
delay(2000); 
}

Have you looked at the blink without delay example?

Have you though about passing an array of pin numbers instead of a single pin number to the function?

MarkT:
Have you though about passing an array of pin numbers instead of a single pin number to the function?

how do i do that, can i get an example?

Any function that takes an array or pointer as an argument should give you a clue.