Does this really need to be in a script?
Using Graph Builder, I drag Y to the Y-zone.
I select both X1 and X2 and drag to the X-zone. I turn off the smoother and this is my result:

Now click the gray triangle next to variables. I can clear either X1 or X2 (they are check boxes) and the graph updates immediately. Clicking again would add that variable back to the plot. I think that the interactive functionality is already there.

Dan Obermiller