Programming error Please Help me

Hello guys i want to make a project with a buzzer with the code below but i can't because i get(when pressed). When not pressed works normally(it shows off only):

on
on
on
on
on
off
off
off
off
on
on
on
on
on
off
off
off
off
const int buzzer = 9; //buzzer to arduino pin 9
const int buttonPin = 4;
int buttonState = 0; 

void setup(){
  
  Serial.begin(9600); 
  pinMode(buzzer, OUTPUT); // Set buzzer - pin 9 as an output
  pinMode(buttonPin, INPUT);  

}

void loop(){
  buttonState = digitalRead(buttonPin);
  if(buttonState == HIGH)
  {
  tone(buzzer, 5200);
  delay(1);
  tone(buzzer, 6100);
  delay(1);
  tone(buzzer, 9100);
  Serial.println("on");
  
  }else
  {
  tone(buzzer, 7300);
  delay(1);
  tone(buzzer, 10100);
  delay(1);
  tone(buzzer, 13000);
  Serial.println("off");
  }
}

A delay of 1 is very small, just one millisecond. I think you want to use delay(1000), which gives you a delay of 1 second. This might explain why you see what you see : https://www.arduino.cc/en/Tutorial/Debounce

i tried using a switch instead of pushbutton and the same... i will try using 1000.

when i connect even just a wire that is in the air and not connected to anything to pin 4 it goes ON OFF ON OFF again... where's the logic?

where's the logic?

The pin is "floating" at an unknown voltage.
Use
pinMode(buttonPin, INPUT_PULLUP);and arrange the circuit so that the pin is taken LOW when the button is pressed.