If it is like my 300SD, then you may have a shutoff valve problem. A vac line goes from your ignition switch to the shutoff valve. When you turn the engine off a vacuum in this line pulls back a lever inside the shutoff valve and the engine dies. It could be that the plastic vac line is bad but my money is on the shutoff valve itself. Takes maybe an hour to replace it. Located in the back of the injection pump - also called a shutdown valve or actuator.
Of course it may be different for a 240.
See a pic in post #11 of
http://www.peachparts.com/shopforum/diesel-discussion/374586-1981-300sd-no-shutoff-how-do-i-find-vac-leak.html However this is a 300SD.