Buying a gift for teacher as a sign of appreciation is always welcome as long as it remains just that. Therefore, when you buy such a gift, be a little cautious so that it does not seem that you are trying to bribe him/her into giving you a good grade. Such gifts should be reasonably priced, not very ostentatious, but at the same time, they should tell your teacher how much you love and respect him/her.
Now, what can you gift your teacher to say that you love him/her? Flowers are all time favorite, but if you want to present something more permanent, there are quite a lot to choose from. A box of assorted chocolate is a good idea. If you know his/her taste, you can present a food basket containing homemade cakes, cookies and shortbreads along with his/her favorite cheese and such other items. However, if you are thinking of something that he/she can keep as a memento, those too should be kept out of your consideration.
Instead, you can consider small, but personalized items such as coffee cups, key rings, wallets. Then you can hunt for beautiful pieces of jewelry such as a pair of cufflinks for men or earrings and pendants for ladies. They need not be costly, but if you try hard, you will find them with intricate designs and smart get up.
Among the utility items, there are pens, pen stand, personal diary or even a calculator. Then there are decorative pieces that never go out of fashion and will remain as keepsake for years to come. If you look for them, you will find plenty of small but interesting items that you can buy for your teacher. Moreover, if you are one of those handy types, you can make something yourself too. Most teachers will appreciate that very much. Options vary from hand made cards to handmade artifacts such as a flower vase to beaded jewelry.
Indeed, what you need to find out first is his/her taste in such matters. If you can do that, getting a suitable gift will not be a problem at all. Always remember, whatever you do, make sure the gift for teacher should show how much you appreciate his/her kindness and love; nothing more and nothing less.