What did you say: 
I mistook one Asian girl I knew for another, and said that "y'all look the same to me."
Why do you think your comment was offensive?
Even though these girls did look alike (they are cousins), only later did I realize that it was exactly in line with the "all asians look the same" branch of racism. Even if I had good intentions, it was still harmful.
What I really meant to say was:
You and your cousin look very similar.
When did you realize?
I realized on my own.