Show exit from a function on the user's screen

I am currently trying to show the output of a function on a user’s screen in real time.
Has anyone done this?

Ex function:

def fun() do
System.cmd("echo", ["test"])

Why don’t you use IO.puts/2?

You’ll have to clarify further. I suspect you don’t mean the plain and simple printing to console that literally every language can do and you have something else in mind.