output is going and going on line by line and consuming my pc\'s resource.see this screenshot I want to only leave last 50 lines of code while running, no previous output ne