Essay due in just over a week and, of course, I spend the first night writing up a plan and writing a (future-proofed) script so that I'll be able to generate the PDF painlessly.
The difficulty lay in figuring out that pandoc won't support taking a list of input files: those files must be specified in the command itself. This is unlike wc, which will take --files0-from=contents.txt (where contents.txt contains each file to be operated on on one line).
So the solution: define variable INPUT=$(sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' <contents.txt) (this replaces newlines — required by wc — with spaces, required by pandoc), then pandoc … -f "$INPUT" -t '"$EXAMNUMBER"_"$WORDCOUNT"words.pdf' (the university specifies that all submitted files must be named with only the exam number and word count).