Pastey output and input at the same time (for shell view, inputting commands)

-- experiment.e
include std/convert.e 
include std/os.e 
include std/io.e 
include std/task.e 
include std/console.e 
 
integer i=0 
sequence accum = {} 
integer changed = 1 
while 1 do 
     
    integer ch = get_key() 
    --? ch 
    if (32 <= ch and ch <= 126) -- normal ascii chars 
    then     
        accum = append(accum, ch) 
        changed = 1 
    end if 
    if ch = 27 then -- ESC to clear input line 
        accum = {} 
        changed = 1 
    end if 
    if changed then 
        clear_screen() 
        puts(1,accum) 
    end if 
     
    sleep(0.020) 
    changed = 0 
end while