Туда - is the answer on the question куда? (its like "to where"). Я иду куда? Туда, в магазин. Where am I going? To the shop.
Там - is the answer on the question где? (again, "where"?) Где ты купил это? Там, в магазине. Where did you buy this? Over there, in a shop.
I hope it got more clear)
Ow, btw, there is a difference between "там" и "тут")