I need help with my code. Howe can I make the text to display certain time.

I want two blocks of text to be displayed every 2 seconds. However, when I try running the code, just the second block is displayed.
Here is the code:

unsigned long previousTime = 0;
unsigned long previousTime2 = 0;
const long intervalTime = 2000;

void loop() {

customKey = customKeypad.getKey();
if (customKey) {
tone(buzzer, 1000, 100); //activate buzzer, keys sound when presssed
}
unsigned long currentTime = millis();
while (customKey == NO_KEY) {

if (currentTime - previousTime > intervalTime) {
previousTime = currentTime;
// display first block of text.
}
unsigned long currentTime2 = millis();
if(currentTime2 - previousTime2 > intervalTime) {
// display second block of text
}
switch(customKey) {
case 'A':
lcd.print("");
break;
}
}
}

This isn’t actually your code as thus doesn’t print anything.

You need to show your actual code if you want us to tell you what is wrong with it.

Also read the guide in how to post questions - coz somebody is going to mention code tags (with good reason!)

What do you mean by "display"? Where do the two text suppose to go to be displayed?

currentTime is not updated in the while loop.

Why use a while loop in the first place when the loop() function does what its name implies.