I want to know what's wrong with my coding

This might work for you but I haven't tested it yet. You will have to adjust the output2Pin assignment:

const int output1Pin = 2;
const int output2Pin = 3;
const int inputPin = 12;
const unsigned long outputTime = 10000;

unsigned long previousTime = 0;

int outputState = 0;

void setup()
{
  pinMode(inputPin, INPUT); // pressure switch low input
  pinMode(output1Pin, OUTPUT); // compressor-01 start command
  pinMode(output2Pin, OUTPUT);
}

void loop()
{
  static int lastInputState = digitalRead(inputPin);
  int currInputState = digitalRead(inputPin);
  unsigned long currentTime = millis();
  
  // If input went from LOW to HIGH reset output sequence
  if (lastInputState ==LOW && currInputState == HIGH)
  {
    previousTime = currentTime;
    outputState = 0;
    digitalWrite(output1Pin, HIGH);
    digitalWrite(output2Pin, LOW);
  }
  
  // If input is HIGH execue output sequence
  if (currInputState == HIGH)
  {
    if (outputState == 0)
    {
      if (currentTime - previousTime > outputTime)
      {
        previousTime = currentTime;
        digitalWrite(output1Pin, LOW);
        digitalWrite(output2Pin, HIGH);
        outputState = 1;
      }
    }
    else
    {
      if (currentTime - previousTime > outputTime)
      {
        previousTime = currentTime;
        digitalWrite(output1Pin, HIGH);
        digitalWrite(output2Pin, LOW);
        outputState = 0;
      }
    }
  }
  else
  {
    digitalWrite(output1Pin, LOW);
    digitalWrite(output2Pin, LOW);
  }
  
  lastInputState = currInputState;
}