"I was in America for 10 years" means what you want.
You would use "I had been in America for 10 years" (the past perfect) if you were talking about a particular time in the past, and saying that by that time you had lived there for 10 years. It doesn't rule out the possibility that you continued to live there afterwards (or are still there).
The perfect aspect is used to denote the circumstance of an action's being complete at a certain time. It is expressed using a form of the auxiliary verb have (appropriately conjugated for tense etc.) together with the past participle of the main verb: She has eaten it; We had left; When will you have finished?
Perfect forms can also be used to refer to states or habitual actions, even if not complete, if the focus is on the time period before the point of reference (We had lived there for five years).