Yes kaimashita is the past tense of "to buy" in a polite way.
*I want to add something to Pim's answer.
I am not a Japanese teacher, but as a native Japanese speaker usually we don't say "kinou wa" like saying "wa" after the noun for time. we usually ommit saying "wa" here.
We say "wa" after the noun for time only when we emphasize the time.
So, when I hear someone saying "kinou WA hon *wo kaimashita",(*"wo" may sounds like "o" to you but we pronounce it as "wo" all the time)
I expect this person go shopping very often, and talking about specifically what they bought "yesterday".
So, unless you want to emphasize the time, you don't need to say "wa" after the noun for time.
I'll give you some situations we use "kaimashita".
1. "kyou ninjin wo kaimashita"= (I) bought a carrot/carrots today.
kyou(today), ninjin(a carrot/carrots *no plural in Japanese) wo (indicating what you are talking about) kaimashita(past tense of "to buy" in polite way).
*In Japanese we often omit saying subjects like I, you etc.. you see this in other examples below.
2. "kinou manga wo kaimashita" = (I) bought manga yesterday.
kinou(yesterday) manga(you know manga) wo (indicating what you are talking about) kaimashita(past tense of "to buy" in polite way).
3. "ototoi kagami wo kaimashita" = (I) bought a mirror/mirrors the day before yesterday.
ototoi(the day before yesterday) kagami(mirror) wo (indicating what you are talking about) kaimashita(past tense of "to buy" in polite way).
4. "atarashii kuruma wo kaimashita" = (I) bought a new car.
atarashii(new) kuruma(car) wo(indicating what you are talking about) kaimashita(past tense of "to buy" in polite way).
*kaimashita is already past tense, so you don't have to say when if you don't wanna say when.
I hope it helps.