Combining an image seqence into a single image
You can't really do recursive operations (loops) in the compositor, but in this case there is a sort of hack you can do (a bit like this or this).

You can apply this to the animation as it's rendered, but I preferred to render everything to .exrs and composite afterwards.


Add an image sequence node (or renderlayer node) that gives the raw render output
Add an image sequence node pointing to the output directory where you'll render the combined sequence.
To do this you may have to create a few dummy files to convince blender that there is an image sequence there. Copying at least the first few frames of the render output to this directory will do, but be sure to delete them once the node is added.
On the image sequence node, set Frames to the length of your render and the Offset to -1. Be sure that the start frame is set correctly as well.
This will make the image sequence node read the previous frame.
Add a file output node or use a composite node and adjust the scene output settings. Set the output path to the directory the image sequence node is pointing to. You may want to render to .exr files so you can adjust the exposure later.




Then render the animation.

This will start by adding the first frame to nothing (as the 0th frame doesn't exist), then the second frame to the first, and the third to the combination of the first and second, and so on. The end result will be an animation like this:



The last frame is the result of all the frames added together: