That’s not how the usual command-line app running on a dumb terminal—or running on a somewhat smarter emulation of a dumb terminal—typically works.
Most such apps use either output text directly, or will wrap text with ANSI escape sequences for graphics and positioning.
You’re closer to designing a GUI app design, here.
I’ve seen a few terminal frameworks that simulated subwindows within a larger terminal window, but those are pretty rare nowadays. The C ncurses library can do that, and there are others. I don’t know of a Swift framework (whether from Apple or from a third-party provider) that does that, but there might be one.
Input parsing is usually with getopt or getopt_long from C or Swift command line frameworks (some info, more), or a text parser. Ragel, for instance. It’s possible to do a GUI-like input with ncurses or such, but thar;s lretty rare these days.
So… What are you up to here?