Difference between these two sentences (Had lived and lived)

Could someone point out the difference of this two sentences?
I had lived in Moscow for 8 years.
I lived in Moscow for 8 years.

Thanks in advance.

“I had lived in Moscow for eight years,” is the sentence you would use in a narrative about something in the past that happened after you lived in Moscow.

“I lived in Moscow for eight years,” can be used in isolation or in narratives about the present.

Would this sentence make any sense then? -
I had lived in 8 Moscow for 8 years. Now I am a student and I’m pursuing high education.

Does using “had” in this phrase indicate that I wasn’t a student when I was in Moscow, and became one only after I left it?

If you don’t live in Moscow anymore, you would say, “I lived in Moscow for eight years. Now I’m a student, and I’m pursuing a higher education.” (It should be “a higher”, not “high”.) [past tense + present tense]

If you still live in Moscow, you would say, “I have lived in Moscow for eight years. Now I’m a student, and I’m pursuing a higher education.” [present perfect tense + present tense]

If you are in the middle of a longer story about the past, you would use use “had lived” in a sentence like this: “Before I came back to Georgia to pursue a higher education, I had lived in Moscow for eight years.” [past + past perfect tense]