Recording the merging of two pdf's using writer

I recorded the motions of opening a pdf, open a second pdf, select the second pdf in the document pane, Cnt C, switch to first pdf, Cnt V, export as pdf and save over the first pdf, close each pdf and then stop recording.

The process worked perfectly but when I inspected the macro; not so sure. I called the macro AttachPDF and this is the code:

sub AttachPDF

rem ----------------------------------------------------------------------
rem define variables

dim document   as object
dim dispatcher as object

rem ----------------------------------------------------------------------
rem get access to the document

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

rem ----------------------------------------------------------------------
rem dispatcher.executeDispatch(document, “.uno:OpenFromWriter”, “”, 0, Array())

end sub

I get the document and dispatcher lines but I expected to see some code accessing the DOM.

Is it possible for me to record the actions of merging two pdf’s or do I need to write the code from scratch. If so, am I able to do it in python