Both tenses are used to narrate a past action. The preterite is used for a completed one-off action in the past, whereas the imperfect tense would be used for an ongoing action in the past that hasn't been completed. It's also used to convey a sense of routine - something you did every day.