I’m not on my computer, but have a look at the attached file here, it should get you going:
Edit: That might not actually be very helpful, but good fun though. Try moving the instantiation of the a and b variables here (i.e. which will make them persistent):
# Instantiate or reset persistent counter variable
if "count" not in globals() or not Run:
count = 0
a = rg.Point3d(0,0,0)
b = []