from tqdm import tqdm
from time import sleep
text = """
This is text 123
""" * 100
# repeate text 100 times
with open('out.txt', 'w') as f:
bar = tqdm(total=len(text), unit='B', unit_scale=True)
for c in text:
f.write(c)
bar.update(1)
sleep(0.0005)