Programming Sensor with Buzzer

I want to connect a a PIR sensor to a Passive Buzzer. I am having trouble with the code. Below is where I am at so far. It shows the code for the buzzer but how do I write the code for the buzzer to be variable to the sensor. (the code below may have a few errors that maybe a person more knowledgeable would notice?)

//
const int buzzerPin = 4;//the buzzer pin attach to
int fre;//set the variable to store the frequence value
/
/
void setup()
{
pinMode(buzzerPin,OUTPUT);
}
/*******************************************/
void loop() {

{
for(int i = 200;i <= 800;i++) //frequence loop from 200 to 800
{
tone(4,i); //turn the buzzer on
delay(5); //wait for 5 milliseconds
}
delay(4000); //wait for 4 seconds on highest frequence
for(int i = 800;i >= 200;i–)//frequence loop from 800 downto 200
{
tone(4,i);
delay(10);
}
}

how do I write the code for the buzzer to be variable to the sensor

I don't see anything relating to a sensor.

I also don't see code tags