Script to connect 2 curves

Hi,
I am trying to write a script to connect 2 curves called a1 and a2 from the command line (something like _connect a1 a2 Enter
Can anyone help me please?
Thanks for your time

Have you tried join command?