거 is the casual 것 'thing, one', and the modifier in front says which kind: 사고 싶은 거 사 'buy whatever you want', 먹고 싶은 거 사 먹고 'bought and ate whatever I fancied'. Five of these lines use 같은 거 'things like ___', the standard way to give an example without being exact — 만년필 같은 거 사서 쓰세요? 'do you buy and use things like fountain pens?'. 사 먹다 is one everyday verb: buy food and eat it, i.e. eat out rather than cook.