It's a bit unclear & we'll be changing how this works in the future, but you have to click the "pay loan" button in the bookkeeping scene on the last day to actually pay off your loan and get the good ending. Hope that helps!