Help with my project for garage door arduino

Sorry for the code :-(, this is my firs time to post here.
I mean to call a function in this section:

if (rfOpen == HIGH)                    // Check if RF Remote trigger input for opening gate
 {         
    digitalWrite(ledPin, HIGH);
    doorOpen();                         // Start a function for opening
  }

And the function (I think it shoud be) something like this:

void doorOpen()
{
  do
  {
    digitalWrite(doorOpenAPin, LOW);    // Open relay for opening wing A
  }                                     // until
  while (doorOpenSwitchA != 0);         // limit switch for opening wing A doesnt close
  delay(2000);                          // wait 2-3 sec
  
  do
  {
    digitalWrite(doorOpenBPin, LOW);    // Open relay for opening wing B
  }                                     // until
  while (doorOpenSwitchB != 0);         // limit switch for opening wing B doesnt close
}

I think some thing like that...