Help with LCD updating analog signal

Hello, I am having trouble with updating my LCD without flickering,
I have a project where there is a 4x4 keypad and an lcd and a temp sensor, how can I make it that the lcd only updates once when the temp changes,

if (customKey == 'B')
{
tempa = true;

while (tempa = true)
{
lcd.clear();
lcd.begin(16, 2);
celsius = map(((analogRead(A0) - 20) * 3.04), 0, 1023, -40, 125);
lcd.print(celsius);
lcd.print(" C");
if (customKey)
{
tempa = false;
}
}

}

Please read How to use this forum - please read. - Installation & Troubleshooting - Arduino Forum, specifically point #7 about posting code using code tags.

Please post complete code; if too big either attach or (preferably) write a small program that exhibits the problem.

while (tempa = true)

Modify above; '=' is an assignment, '==' is used to compare. Updated version

while (tempa == true)

Further I don't think that your code will work unless you modify customKey in the code that you did not show.

The lcd.begin belongs in setup. That initializes the LCD and needs to be done only once. Do not use lcd.clear in loop. Overwrite old data with spaces, reset the cursor position and print new data.