The value of K1111 is overwritten with the next value in every loop iteration - is this your intention, or did you maybe mean to add them up? That is, for example,
K1111 = K1111 + inv(J) * F(a,A) * F(b,B) * K(A,B,K,D) * F(K,K) * F(d,D);
I'm also getting the impression you're using the same variable name K for both the iterator in the for-loop and the tensor K you're operating on. The formula you wrote up was using F(c, C) instead of F(K, K) in the code.