I don't think you need a script to get something close to what you want. I mocked up a dataset to mimic your scenario. The X-axis variables are called Level 1, Level 2, and Level 3. The response variable I called Response. The By variable I called Grouping. I have attached the table to this post.
Since you are looking for a graph, I went to Graph > Graph Builder.
Drag Response to the Y-axis.
Drag Level 1 to the X-axis.
Drag Level 2 to the X-axis so that it is just "inside" the x-axis border. You will see the graph update to show the nesting of the two variables.
Repeat this process for Level 3.
Now drag the ByVar over to the Grouping area.
That should give you a plot with all of the points.
Dan Obermiller