This is a tricky grammatical question that is asked a lot by students, but there are several differences between the two. Perhaps the most important difference is that el pretérito is used to refer to single, completed actions in the past, where as el imperfecto refers to previous habitual actions or events that occurred over a period of time.
E.g. Ayer, jugué al fútbol con mis amigos en el parque (Yesterday, I played football in the park with my friends.) versus De nino, jugaba al fútbol con mis amigos cada domingo.
Another difference is that el imperfecto is used to serve as a background for a main action which is described using el pretérito.E.g. Escribía una carta a mi tía cuando me llamó de la nada (I was writing a letter to my aunt when she called me out of nowhere).