transfer files using Target disk mode

From my macbookPro 2019 I’d like to create a script which would automatically save one file both on a MacPro6 Late 13 and an eternal drive connected to the MacPro6 or the Macbookpro.
Both machines are on Mojave and on the same network connected through system preferences as File Sharing.
How can I do so?
Mojave no longer allows to connect the machines as Target disk mode maybe because the ports are different kinds of thunderbolt.
Is there a script could use?

Thanks a lot

Model: MacbookPro2019
Browser: Safari 537.36
Operating System: macOS 10.14