Again, you probably want to use a menu for this task, but without knowing more about what you are trying to do, it is hard to say.
Assuming "WHAT" is a sequence of characters entered by the player, you'd want to use the menu:on_character_pressed(character) function. It could look something like this:
local chars_pressed = {}
function my_menu:on_character_pressed(character)
table.insert(chars_pressed, character)
end
function my_menu:print()
local str = table.concat(chars_pressed)
print(str)
chars_pressed = {} --clear table
end
Note that this is compatible with utf-8 (international) characters, but be warned that str:len() will return the number of bytes in the string, not necessarily the number of characters. i.e. if the player enters 4 characters that are each multi-byte characters of 2 bytes, then str:len() would return 8 even though there are only 4 characters. Instead, #chars_pressed can be used to get the number of characters entered.