If the engine keeps shutting off you may want to replace the fuel filter that is in the tank of the whacker. If that doesn't solve issue sheck fuel line for a leak.
If you're weed whacker continually shuts off, you may need to warm up the 2 stroke engine, this requires playing with choke settings. Also before doing that, check the gas to oil ratio and make sure it is correct. Also if you're still having problems, check the state of the spark plugs for dinginess.