I’m not 100%, but I think that line() is building as intended. But I don’t think triangle() is working step-wise with line(). It’s not returning: ... 8\n******** 9\n********* 10\n**********
Rather it seems like the results of line got ‘stuck under’ one string that was returned by triangle. Every time triangle ran it returned \n + line(...), hence line stacked. While the first triangle to run returned one string ‘10987654321<END’.