Send output by app that termux can capture without root or adb

Is there a way so when a screen closes to return a valve that can be then printed to termux with am or anything like that? Because I always had that cool idea about apk packages that dont have gui and return to standard output

I did some work on this a few years ago:

Maybe you can develop on from there ?

Basically Im think of it in a way so when I start my app with am start and termux, i see a printed message on the terminal, thats what Im trying to achieve as starting point, super minimal

You can build a "terminal" in your app using a textbox component, Taifun's textbox extension, and some blocks coding.

Yea but this wont send output to termux when run, its like building another terminal app

It could be made to