I'm not quite sure what you are trying to do, but at a guess you want to have a separate XML output per site.
Try this:
FOR EACH tt_Woorder NO-LOCK BREAK BY tt_Woorder.tt_site:
IF LAST-OF (tt_Woorder.tt_site) THEN DO:
// DATASET dsproductionPlan:write-xml("file", lXmlPathName ,true, ...