How can you show text in-game?
I downloaded a Minecraft map but when I open the the doors there is a text that comes on the screen that says "open and close". How do they do this? Do they use commands?
Can you provide screenshots? It's hard to know what kind of message you're referring to since it could be a message in chat, actionbar, title, floating text, etc.
You can try to run any of these commands to see if it's the message you're seeing:
/title @s actionbar open and close
/title @s title open and close
/tellraw @s {"rawtext":[{"text":"open and close"}]}
/say open and close
/w @s open and close