Would you help me with the corrections to the code? I'm trying but I'm not able to get the keys to print it the way I want.
Not me. I've tried, from the beginning, to get you to build functions that handle the various task. You seem welded to the idea that everything needs to happen in loop(), and unwilling to concede that that is NOT the case.
It is far simpler to debug 20 to 25 lines of code that deal with getting input and displaying it on the LCD in a known position (hint: you know where to store the data in the array, so use that index value to "guess" where to display the character on the LCD) than it is to wade through hundreds of lines of code in loop().