OpenCPN/VDR has no "format", what it saves is simply a text file with the NMEA stream, so it really does not matter if you create it with some other tool.
For example this is what I use when I need to record
data stream from UDP port 10110:
ncat 192.168.1.36 -u -l 10110 -o mydata.txt
Using ncat (from the nmap package), but you can of course use nc or netcat or whatever is now available on Raspbian.
You can trigger this with anything you want and kill it whenever you want.
In case you want to save the data coming from the serial ports
(Which is not a good idea), you can do it with something as simple as
cat /dev/ttyUSB0 > mydata.txt