If I understand you correctly, you are expecting the print() statements to execute immediately when they are encountered in the loop, and not all at once at the end of the program.
To do this, you need to call sys.stdout.flush() after each print() statement.
Here is your code with my suggestions added:
import pygame, sys
def main():
pygame.init()
screen = pygame.display.set_mode((600, 400))
frame_count = 0
# The clock helps us manage the frames per second of the animation
clock = pygame.time.Clock()
square = pygame.Rect((0,100),(50,50))
done = False
while not done:
# Erase the screen
screen.fill((50, 50, 50))
# Process events
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# The main snake code
square.move_ip((50,0))
pygame.draw.rect(screen, (200,50,50), square)
print(square)
sys.stdout.flush()
frame_count += 1
if frame_count >= 5:
done = True
print(done)
sys.stdout.flush()
# set fps
clock.tick(1)
# Bring drawn changes to the front
pygame.display.update()
print("Out of loop")
sys.stdout.flush()
pygame.time.delay(2000)
# This also works to bring up the last frame.
# pygame.event.clear()
# pygame.event.wait()
pygame.quit()
print("After quit")
pygame.time.delay(2000)
sys.exit()
main()