puts statement in ruby automatically adds a new line, how do I avoid it?
puts
Use print instead. You may want to follow it up by STDOUT.flush.
print
STDOUT.flush