You are right! You can say What do you need this for? or Why do you need this?.
Now, please keep in mind that It can be said differently depending on the context, like:
- Why would you want that?
- What are you planning on doing with that?
- Why is that so important to you?
- Do you really need that?