you might try to change line 24 to:
l = rs.AddPolyline([newPts, newPts, newPts, newPts, newPts])
and then in line 26:
recursive(v1, newPts, gens-1)
hard to guess whats wrong without having a file to test. The error you get means that it cannot append to a tuple. You may change line 29 to create a list instead of a tuple:
allLines = 
Good guess !!!
Thank you very much. you have no idea how it helps me.