As mentioned in comment, neither Maple nor Mathematica can solve the heat pde analytically with the $K$ coefficient (thermal conductivity of the material) as function of space. Mathematica can solve it for scalar $k$ which I show below so you can use if you want to try for yourself.
Heat PDE depends on time and space. You have not said what the initial conditions are. Assuming $u(x,0)=f(x)$ then
ClearAll[u, x, t, Tm, Tk, h, f, n, z, k];
pde = D[u[z, t], t] == k*D[u[z, t], {z, 2}]
bc = {u[-h/2, t] == Tm, u[h/2, t] == Tc}
ic = u[z, 0] == f[z]
sol = DSolve[{pde, bc, ic}, u[z, t], {z, t}, Assumptions -> {h > 0, t > 0, k > 0}];
In the steady state (which you showed), i.e. as $t \to \infty$ then we see due to the term $e^{-\frac{\pi ^2 t K[1]^2}{h^2}}$ it will go to zero. Hence the sum term vanish and the solution at steady state becomes
This does not match what you showed, but $k$ used here is not function of space.
May be Mathematica in next version could solve the heat pde with $k$ function of space.