The following AppleScript will allow you to select n-tuple PDFs from a file chooser, and then merge them in selection order to a user-designated output pdf (in this case ~/Desktop/merged.pdf). With little effort, this AppleScript can be adopted for use in a Run AppleScript action in an Automator Application, Quick Action, or Shortcut.
Copy and paste into Apple's Script Editor, compile, and run to test. Does not change any existing PDF.
(*
merge_pdf.applescript
Prompt user for PDF filenames to merge using the ⌘-key for multiple selection.
PDF will be merged in the order of their selection and written to an arbitrary
PDF filename on the Desktop (in this example, merged.pdf)
Tested: macOS 11.4, 11.6.5, 12.3
VikingOSX, 2021-06-24, Apple Support Communities, No warranty/support implied.
*)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use framework "Foundation"
use scripting additions
property NSString : a reference to current application's NSString
property NSURL : a reference to current application's NSURL
property PDFDocument : a reference to current application's PDFDocument
# tilde path to absolute path
set merged_pdf to (NSString's stringWithString:"~/Desktop/merged.pdf")'s stringByStandardizingPath()
set msg to "Select multiple PDF using the ⌘-key in the order of your merge preference."
set pdfList to (choose file with prompt msg of type {"com.adobe.pdf"} default location (path to desktop) with multiple selections allowed)
set outurl to NSURL's fileURLWithPath:(POSIX path of (item 1 of pdfList))
set outpdf to PDFDocument's alloc()'s initWithURL:outurl
set pdfList to rest of pdfList
set lastPage to outpdf's pageCount()
repeat with pdfdoc in pdfList
set thisURL to (NSURL's fileURLWithPath:((POSIX path of pdfdoc) as text))
set thisPDF to (PDFDocument's alloc()'s initWithURL:thisURL)
# PDF pages are zero-based
repeat with n from 1 to thisPDF's pageCount()
set this_page to (thisPDF's pageAtIndex:(n - 1))
(outpdf's insertPage:this_page atIndex:lastPage)
set lastPage to outpdf's pageCount()
end repeat
end repeat
outpdf's writeToFile:merged_pdf
return
I also have this written in Swift for those that want a compiled tool.