Actually, you don’t need a script for this task. You can do this quite easily with Image Magick which is a set of command-line tools for processing images in limitless ways. You can download it from here (https://imagemagick.org/script/download.php).
Then if you have a folder with all your animation frames inside it you can stitch them together using this command (this example assumes your images are pngs):
convert -append *.png output.png
This will create a PNG file called output.png which will be a vertically stacked image. The *.png line tells image magick to look for all png files in the folder you are in. The png frames will need to named in a way that means they will be in the correct order if you were to sort by name. For example you could have something like:
file_003.png … etc.
If you’re using numbers in the filenames it’s important to zero pad them (i.e. 1 would e 001, not 1) because computers sort alphabetically so file_2 would be sorted. after file_112.