used to = 以前
It is the past tense of the present simple.
Present simple = repeated actions, or states, spanning the present
used to = repeated actions, or states, spanning a finished past time frame
I used to live in a flat, now I live in a house.
In this sentence, there is no adverb or expression of a definite time.
I was living in a flat then. Now I'm living in a house.
In this sentence we have an adverb or expression of time.
The difference is sometimes very small. But note, do not use "used to" when you have an expression of a definite time.
If you want to express a repeated action in the past at a definite time, use "would".
When I was a boy, we WOULD go to the park a lot and play football.
This is one of the trickier rules of English. It takes a bit of practice to get it down pat.