How to find the transfer function of this digital controller and DC Motor?
this should be -1 in both cases, because it refers to a negative feedback being unitary 

TF_DC_vel_closed = feedback(TF_DC_vel, -1)


The \$ T \$ means the sampling period, so, every \$ T\$ seconds the system gets new sensor measurements and updates its output \$u(t)\$.

Also, notice that you have not used at all gho. 

I would suggest discretizing \$G_{p1}\$ with \$T=0.1\$s . Then doing the feedback(\$k_2 G_{h0} G_{p1} \$) = \$ \hat{G}\$.
Then do the feedback(\$ D(z) \hat{G} G_{p2}\$). That would properly combine the system blocks.