Problem with buzzer and buttons

Hi
I got a problem with my arduino uno, So i want to make a circuit with 2 button, 1 led and a buzzer, when i push on a button the led and the melody work, and when i push on the second button that turn off the led and the melody but that don’t work,

int ledPin = 13;        
int inputPin1 = 3;      
int inputPin2 = 2;      
int speakerPin = 9;
int a = 0;
int length = 15; 
char notes[] = "ccggaagffeeddc "; 
int beats[] = { 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 4 };
int tempo = 200;
void playTone(int tone, int duration) {
  for (long i = 0; i < duration * 1000L; i += tone * 2) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(tone);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(tone);
  }
}
void playNote(char note, int duration) {
  char names[] = { 'c', 'd', 'e', 'f', 'g', 'a', 'b', 'C' };
  int tones[] = { 1915, 1700, 1519, 1432, 1275, 1136, 1014, 956 };
  
  for (int i = 0; i < 8; i++) {
    
    if (names[i] == note) {
      playTone(tones[i], duration);
    }
  }
}
void setup() {
  pinMode(speakerPin, OUTPUT);
  pinMode(ledPin, OUTPUT);   
  pinMode(inputPin1, INPUT); 
  pinMode(inputPin2, INPUT); 
}

void loop() {
  if (digitalRead(inputPin1) == LOW) { 
    digitalWrite(ledPin, LOW);  
    a=0;  
 } 
 
 else if (digitalRead(inputPin2) == HIGH) {      
    digitalWrite(ledPin, HIGH);
    digitalWrite(speakerPin, HIGH);
   a=1; 
 
 }
if (a == 1){
for (int i = 0; i < length; i++){
    if (digitalRead(inputPin2)==HIGH) 
    {i=20;}
    if (notes[i] == ' ') {
      delay(beats[i] * tempo); // rest
    } else {
      playNote(notes[i], beats[i] * tempo);
    }
}
    
    delay(tempo / 2); 
}
}

Here i need to still pushing on the button for turn on the buzzer.

Here i need to still pushing on the button for turn on the buzzer.

No idea what this means.

There is no way to tell from the limited information you provided whether you have a hardware problem or a software problem. You have not described how your "buttons" are wired. I'll presume that you didn't sew them on.

You are not reading the state of the switches while playTone() is executing. Since that is called by playNote, and you don't read the state of the switches in that function, either, you are not reading the state of any switch for the duration of a call to playNote().

    if (digitalRead(inputPin2)==HIGH) 
    {i=20;}

The i = 20 part should be a break, to break out of the for loop. Meaningful names for the pins, like startPin and stopPin would make more sense than one and two.