"What do you buy?"
かいます is an action Verb. Hence we need a particle to show the object upon which it is acting. When you say 何 かいます- there is no relationship between what and buy 【what 】 【buy 】. It is like randomly blurting "what" "buy"
The sentence 何を買います is : 【what 】<--【buy 】 the を helps establish this relationship between what and buy