Both the imperfect and the preterite tense are past tenses, but it is important to learn the distinctions between the two.
Generally the imperfect tense is used to speak about a repeated action in the past, for example "I used to play football two times a week when I was younger" would use the imperfect and be translated to "yo jugaba al fútbol dos veces por semana cuando era más joven". The imperfect is also used when an action is incompleted and there is therefore not definitive end, for example "my mum liked to go shopping" has no definitive end or beginning and therefore would use the imperfect and be translated to "a mi madre le gustaba ir de compras". Another reason to use the imperfect is when speaking of an action that was interrupted, for example "I was listening to music when my mum asked me to help her" would be imperfect when referring to the action of listening to music (as this is what was interrupted) and would hence be "estaba escuchando música cuando mi madre me pidió que le ayudara".
On the other hand, the preterite is used when speaking of actions in the past which have a definitive beginning and ending and therefore are complete. For example, "we danced for two hours" would be translated using the preterite as this shows a specified period of time and therefore would be "bailamos durante dos horas".