How do I derive the aggregate demand function given two utilities functions?
If you have $J$ consumers therefore $J$ demands for a good $X$. Denoting the individual demand of each consumer with $x_j^*$ as you have it, if $X$ is the aggregate demand, it is just the sum of every individual demand:
$X=\sum_{j=1}^{J}x_j^*$
Then for your case it's: $x_1^*+x_2^*=\frac{(I_1+I_2)}{2P_X}$, and the same with $Y$.