Code problem with LED

val = digitalRead(pirState); //read input and store it

//check whether the input is HIGH
if (val ==HIGH) {
  digitalWrite(ledPin, HIGH);  // Turns the LED on
  if (pirState == HIGH) {
    
} else {
  digitalWrite(ledPin, LOW);   // turns the LED off
  if (pirState == LOW) {

  }

This part of loop() is bogus. digitalRead expects an input pin as parameter - you use pirState, which is HIGH/LOW instead of inputPin. What you want is to read the state of the sensor and then set the LED accordingly. Just write the read state of the sensor to the LED:

pirState= digitalRead(inputPin);
digitalWrite(ledPin, pirState);