@helenabessa123, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project
See About the Installation & Troubleshooting category.
As the @groundFungus and @anon87005993 mentioned, properly indenting your code using tools -> autoformat will reveal what is wrong. This is what it looks like after an autoformat.
#include <Servo.h>
Servo servo1;
Servo servo2;
#define pushButtonPin 2
int pos = 0;
int pos2 = 0;
int buttonPushed = 0;
void setup() {
Serial.begin(9600);
servo1.attach(3);
servo2.attach(5);//
pinMode(pushButtonPin, INPUT_PULLUP);
Serial.println(" 123 ");
servo1.write(pos2);
servo2.write(pos);
}
void loop() {
if (digitalRead(pushButtonPin) == LOW) {
buttonPushed = 1;
}
if ( buttonPushed ) {
for (pos = 0; pos < 180; pos += 1)
for (pos2 = 0; pos2 < 90; pos2 += 1)
{
buttonPushed = 0;
}
}
for (pos = 180; pos >= 1; pos -= 1)
for (pos2 = 90; pos2 >= 1; pos2 -= 1)
{
buttonPushed = 0;
}
}
servo1.write (pos2);
servo2.write (pos);
Serial.print("Moved to: ");
Serial.print(pos);
Serial.println(" degree");
delay(50); //
}
}
}
}
Each function (setup() and loop() in this case) start swith a { and ends with a }; a } at the beginning of a line indicates the end of a function. @anon87005993 already indicated where your loop() ends.
So the rest of the code is outside a function which is not allowed.
Further, you should never have more than one } at the beginning of a line at the end of your code. So below indicates a problem.
...
...
delay(50); //
}
}
}
}
How useful your code is, is debatable at this stage. Why would you set buttonPushed 180x90 times to 0? And by the time you reach servo1.Write() and servo2.write(), pos and pos2 are both 0. I suspect that those actually should have been inside the for-loops.