Is there a way to autogenerate documents from multiple text files?

Sorry this for a rather unusual case, but what I’m looking for is this:

A simple - ideally direct - way free of a daisy-chain of apis and programs, for automatically taking the contents of separate text files and combining them in a specified order with some formatting rules in a single file, possibly a .pdf? How would be the best way of doing that?

thanks.

Take a look at Pandoc. If your formatting rules are in a somewhat common from (e.g. markdown) it can probably handle them. And according to the manual it can concatenate multiple input files.