The correct phrase is "a year." The article "a" is used before words that begin with a consonant sound, while "an" is used before words that begin with a vowel sound.
In the case of "year," even though it starts with the letter "y," the pronunciation begins with a consonant sound (/j/ sound). Therefore, you would say "a year."
"I have been living here for a year."
However, it's worth noting that there are some exceptions where "an" is used before words that start with a vowel letter but have a consonant sound. For instance, "an hour" or "an honest person." In these cases, the "h" in "hour" and "honest" is not pronounced, so they begin with a vowel sound.