Is the script working fine for the first time you run it, and then the second time you run for a different level it places the lines on the same view?
If so, then you should add in this solution to “refresh” the ‘Active View’ node: How refresh result of "active view" - #6 by john_pierson
You will need to switch between “true” and “false” each time you run. It doesn’t matter what value as long as it’s different to the last time you run