I can't really read your posted code, but it looks like you missed off the all-important deRegUserTriggers() command? This is the part that automatically runs your code, triggered by the action of opening a layout - hence, you may only need to do this once if the menu is global across all layout windows. When you open a layout window the code is triggered and it adds the menu. Job done!
Am I missing something else?