fixed printing  status, flushes previous status in terminal

Hi, I have made change that the printed status of percentage done is updated, flushing the old one and updating the shell with new one.