Where should 了 go: 你去了商店买什么衣服？ or 你去商店买什么衣服了？
了 following a 'verb' is a 'verb particle' that indicates the 'verb' as 'completed' 

In "你去了商店买什么衣服？" (You went to the store to buy what kind of clothes)  '了' following the verb '去'(go), therefore, indicated '去' as a completed action (went/ have gone to) 

In "你去商店买什么衣服了？" 了 is mostly treated as a final particle, therefore may not clearly indicate what action is completed


  "What clothes did you buy at the store?" 


If you want to mark the verb '买' (buy) as a completed action, you need to put the verb particle 了 after it. 


  "你去商店[买了]什么衣服？" = You went to the store and [bought] what? 


You can even add a final particle 了 at the end to emphasize the sentence --  "你去商店[买了]什么衣服了？"