You just need to keep track of past reading through the main loop:
const int sensor = A0; // analog input use variable resistance
int flagged = 0;
void setup ()
{
Serial.begin (9600);
}
void loop ()
{
if(analogRead(sensor)==1023)//when variable resistance give value =1023 print 'x'
{
if(!flagged)
{
Serial.print("x");
Serial.println();
flagged = 1;
}
else flagged =0;
}
delay (1000);
}