How can i design this function using only NAND and XOR gates?
I have assumed that only 2 input NAND gates are available.

For $\overline {AB}*\overline {CD}$

Take A and B as input and feed them to a NAND gate. U will get $\overline {AB}$.
Similarly u can get $\overline {CD}$.

Now feed $\overline {AB}$ and $\overline {CD}$ as input to another NAND gate . U will get AB + CD using demorgan law.

For ABCD take $\overline {AB}$ and complement it using a NAND gate to get AB. 
Take $\overline {CD}$ and complement it to get CD. Now feed AB and CD to NAND gate. You will get $\overline {ABCD}$. 

Now feed (AB+CD) and (ABCD)' to NAND gate. U will get $\overline{(AB+CD)\overline{(ABCD})}$.Apply demorgan law. U have ur answer.

The trick is to express the function as a sum of products which u already have. Now derive the complement of each product term. When all product terms have been derived then feed then to a NAND gate. This final NAND gate will complement the already complemented product terms and add them thus giving the desired answer.