Combine 2 different function on 1 sketch.

I am working on a project that using 3 motor pumps. The main idea of my project was an automatic aquarium refill which it will flush the water and will refill it back and it will repeat based on timing which now im currently using delay milis as a timing for each motor working

int motorPin = 3; // motor pengisian
int blinkPin = 4; //
int motor1 = 5;// motor pembuangan
int motorklorin = 6;// pam topap 
int switch1 = 2;// switch float
int indicator1 = 7; 
int indicator2 = 8;
int indicator3 = 9;
void setup()
{
  pinMode(motorPin, OUTPUT); 
  pinMode(blinkPin, OUTPUT); // penujuk fasa pengisian
  pinMode(motor1, OUTPUT);
  pinMode(motorklorin, OUTPUT); // MOTOR UNTUK topap
  pinMode(switch1, INPUT_PULLUP);// float switch
  pinMode(indicator1, OUTPUT);// 
  pinMode(indicator2, OUTPUT);// 
  pinMode(indicator3, OUTPUT);// 
}



void loop()

{
  digitalWrite(motorPin, HIGH); // turn on the motor
  digitalWrite(blinkPin, LOW); // turn on the LED
  digitalWrite(motor1, HIGH);// on lampu
  delay(2000);        // 

  digitalWrite(motorPin, HIGH);  // 
  digitalWrite(blinkPin, HIGH);  // indicator for flushing process
  digitalWrite(motor1, LOW);// flushing motor on
  delay(2000);        //duration of flushing

  digitalWrite(motorPin, HIGH); // turn on the motor2 to begin refill
  digitalWrite(blinkPin, LOW); // 
  digitalWrite(motor1, LOW);// motor refill on
  digitalWrite(indicator1, HIGH); //indicator of refill process
  delay(5000);        // refill time


  digitalWrite(motorPin, HIGH);  // turn off the motor
  digitalWrite(blinkPin,HIGH);  // turn off the LED
  digitalWrite(motor1, HIGH);// OFF LAMP all motor stop
  delay(1000);       
 }
}

This was the code for the pump itself to flush and refill. However my idea was to add a float switch. which it will to top up the water incase the water level is low AFTER the process above done and waiting to loop gain

{
if(digitalRead(switch1) == HIGH)
{
  digitalWrite(motorklorin, LOW);
  digitalWrite(indicator2, HIGH);
}
else
{
  digitalWrite(motorklorin, HIGH);
  
  }

this was the code for the float switch. However, I didnt know where i should place the code since the idea was to make the float switch to operated ONLY after the process for flushing and refill done based on the code i give on top.

the problem is each time i place the code anywhere on the is error, i surely hadn't any idea on how to place the code. Any help i'be grateful to hear.

*Im using water pump,float switch,an active LOW relay.

Count your braces.

actually i still didnt get on how to count the brackets. which one i should look one and how?

The one at the end of your top bit of code and the one at the top of your bottom (does that make sense???) seem to be superfluous (that means kinda hangin' out by themselves with no real reason for being there and should probably be deleted but without seeing all the code in a larger context it's tough to say).