can someone please help me know when to use imperfect or preterite..plz...
Use the imperfect to indicate indefinite, open periods of time in the past; it's a non-eventive, background tense.
Use the preterite to indicate definite, closed periods of time in the past; it's an eventive, foreground tense.

If you're new to this, it may require some guess work until you get the hang of it.

Use the imperfect to translate 'used to'.
used to eat - comi'a
used to sing - cantaba
used to sleep - dormi'a

Use the imperfect to translate the past progressive (was/were ---ing).
was eating - comi'a
was singing - cantaba
was sleeping - dormi'a

Use the imperfect to translate verbs with 'no moving parts' - things you can do in your mind without moving a muscle - things that can just 'be'.

knew - sabi'a
wanted - queri'a
was (located somewhere) - estaba

Use the preterite for events and actions:
I ate - comi'
She sang - canto'
They found - encontraron

Use the preterite for a definite duration:
He slept three hours. - Durmio' tres horas.

When telling a story, use the imperfect to describe how things were when the events happened: It was dark and windy. There was no one home.
And use the preterite to ennumerate the events of the story itself: There was a loud noise. A burglar broke into the house. The burglar took all the jewels. He ran away.

If you're familiar with the creation story in the Bible, here's a good illustration of the imperfect - preterite difference:

God said "Let there be light"
And there was light.

How to translate "There was light"?

If we say "habi'a luz" it makes no sense. The imperfect here just tells us the background circumstances in which the events of the story took place. By saying that, we mean to describe the scene as having light -- being lit. God was working 'with the lights on', so to speak. But that's not the meaning. The light wasn't already there. It was created. If the light was already there as part of the background of the story (habi'a luz), nobody would have had to create it.

Therefore we translate "There was light" in this context as "Hubo luz", which indicates that an event occurred. The light came to be.
____

Another example: Both of these sentences have the past tense of have: Sally had a pet dog. Sally had an accident.
One needs the imperfect of 'had': teni'a. The other needs the preterite: tuvo. Which is which?

Which one is a continuing state, not an event? That one will contain 'teni'a' for 'had'.
Which one is an event? That one will contain 'tuvo' for 'had'.

After thinking about it a little, you should conclude that having a pet dog is simply a relationship that 'contains no moving parts'. That one needs the imperfect - teni'a. Having an accident, on the other hand, is an event. That one needs the preterite - tuvo.
_______

Now think about this one: Sally had a baby.
Can you invent a story in which 'had' is 'teni'a'? Maybe you'll need to add a little: Sally had a baby with her when she visited her sister. She had a baby in her arms. ...
Can you invent a story in which 'had' is 'tuvo'? What is the event of having a baby?

You can see that sometimes you can't decide from the written words. Depending on the meaning in your head, 'had' could be 'teni'a', and it could be 'tuvo', even for the same written sentence. Context makes a big difference.

Jim