Your script ran very nicely on my computer, but Helen had a bit of a problem. It doesn't seem to be related to your script, which seems OK, I think it's a bug in Moodle. This is what is happening:
When you try to delete the outcome, then the scale, it seems that the deletion may not work, or that the "delete" icon is not present for either or both of the scale and the outcome.
You've already completed this task, but if you could help us by confirming that there is a problem there, I would be very grateful