can't pass a carriage return using a 4331 with Cisco IOS XE Software, Version 16.09.02
tclsh
puts [ open "flash:clearline.tcl" w+ ] {
set x 98
while {$x < 162} {
puts "clearing line $x"
puts [exec "clear line $x"]
typeahead "\r"
set x [expr {$x + 1}]
}
}