Here is my solution. I found it mostly by trial and error.
I made the line change colour every once in a while so that it would be easier to distinguish different lines when they overlap. Start at the star, with the green line.
(Thanks to Ben Barden, who pointed out a small error in my original solution (and the way to fix it!))