Yes but remember, welding voltage is generally in the 20 vdc range, you have connected two different batteries together which, unless identical batteries already paired together, have a different state of charge. Generally you are going to use a house and starting battery, so one will always be discharging and one will be charging.
If you think it is a good idea knock yourself out. Generally what happens is that you ruin a part that a competent welder can fix as well as the spark damage to your boat from not having welding blankets, and inevitably get battery acid on yourself and your boat.
Offshore, creating a jury rig after being dismasted a thousand miles from anywhere is one thing, for most others find a better way to get home and doa good job of the repair.