That is something you will learn over time.
What can help you is to ask yourself these things before playing a move:
1) What this piece was doing before?
2) How my oponnent could respond that move?