Each edge of the spiral is of square longer than the preceding one. A simple loop draws the edges, increasing the length in each iteration:
MAX_LENGTH = 20 d = 1 while d < MAX_LENGTH walk (kara, d) kara.turnRight d = d + 1 end