The first thing to do is to stop using pin 1 as your input because it is used by the serial port. This will prevent you printing any debugging information if/when you need to.
You need to refine what you mean by
but if it detects a button is pressed
Do you mean when the button is held down or do you you mean when the button is first pressed ? If the latter, then look at the StateChangeDetection example in the IDE. Basically you remember the previous state of the button and only act if has changed.
As to turning the buzzer on/off a number of times, look at for loops in the Arduino reference. They allow you to do repetitive things a number of times without repeating code. Putting the buzzer code in a function would be a good exercise, particularly if you pass it the number of times to sound the buzzer.
Have you got a pull up resistor in your button circuit ?
If not then use
so that the button pin is in a known state at all times.