Not sure what OS you're on, but in Windows it might look like this:
FOR %%F IN (*.txt) DO (TYPE "%%F" | llm -s "execute this prompt" >> "output.txt)
FOR %%F IN (*.pdf) DO (llm -a %%F -s "execute this prompt" >> output.txt)