IR Reflectance Sensor code

I'm new to programming, and I am testing an IR reflectance sensor TCRT5000, my code gives me data but the data does not correspond to what I want it to do. I want the value to go high when it's detecting a white background and low when it's a dark background, but the sensor does not give varied data at all. I have tried changing the sensor(I have about 50) but the data is still not varied and is about 1020.

const int LINE = A2; //line sensors pins

void setup(){
pinMode(LINE, OUTPUT); //set the line sensor pin as output and turned on
digitalWrite(LINE, HIGH);
Serial.begin(9600);
}

void loop(){
int line = analogRead(LINE);

Serial.print(line); //print the value read from the sensor
Serial.print(" ");
delay(500); //reading taken every half a second
if(line>250){
Serial.println("dark"); //if reading above 250, print dark
}
else{
Serial.println("light"); //if below 250, print light
}

}

You are reading from a pin that is set as an output

I commented that line out, but it still isn't sensitive to dark and light? is it the sensor's fault?

Set the LINE pin explicitly to be an INPUT. It should default to that but no harm in doing it. Remove the line that sets the input HIGH.

How is the sensor wired ? What values do you get from it ?