If you just want text to appear on screen like an in-game message/warning would (out of range, etc.), then use the message() function.
(If that's even still in the client... It was deprecated long ago. If that doesn't work, then use UIErrorsFrame:AddMessage("text") -
https://wow.gamepedia.com/API_MessageFrame_AddMessage)
If you want to control when it disappears off-screen, then create your own fontstring and show it or change the text as needed.