In some ways, a terminal-based program is really just an extension of a line printer. It’s designed to output to stdout one line at a time, and doesn’t handle editing in-place very well (which would be required if you wanted to create a terminal-based UI, like Midnight Commander).
There are specific libraries that have been developed to provide more sophisticated capabilities. Here’s a couple of tile-based toolkits that allow you to build up a full UI in the console:
Mosaic is a Kotlin toolkit for building tiled applications e.g. Rogue-like games.
Zirzon is a tile-engine and Text GUI library.
Here’s an example of a GUI written with Zircon:
Thse toolkits really serve a rare circumstance, where you want graphical capabilities but you’re running in a non-graphical environment. Typically if you’re running a modern OS, you have more sophisticated graphical capabilities available.
Here’s a console toolkit that provides further capabilities.