How can I run a single command 1000 times?

I want to use the summon tnt command 1000 times in a function is there another way instead of copy and paste the same command 1000 times? And is there a limit how many commands I can use in a single function?

Continue to help post