Question: Error for doing For Loop

hello Dear

I am new here I am not clear about Loop in Maple, I am stuck here.

Please correct and guide me 

thank you

input

 

Loop

Expect result

-------------------------------------------Code--------------------------------

KTe := Matrix(3, 1, [[Matrix(4, 4, [[216, -288, -216, 288], [-288, 384, 288, -384], [-216, 288, 216, -288], [288, -384, -288, 384]])], [Matrix(4, 4, [[216, 288, -216, -288], [288, 384, -288, -384], [-216, -288, 216, 288], [-288, -384, 288, 384]])], [Matrix(4, 4, [[500, 0, -500, 0], [0, 0, 0, 0], [-500, 0, 500, 0], [0, 0, 0, 0]])]]);
DOFe := Matrix(3, 4, [[1, 2, 3, 4], [3, 4, 5, 6], [5, 6, 1, 2]]);
with(ListTools);


with(LinearAlgebra);
nn1 := Row(DOFe, 1);
                      nn1 := [1, 2, 3, 4]

KG1 := Matrix(6, 6);


KG := Matrix(3, 1);

for k from 1 to 3  for i from 1 to 4 do      for j from 1 to 4 do    nn:=Row(DOFe,k):   KG1[nn1[i],nn1[j]]:=(KTe[k[],1])[i,j]    end do  end do   KG[k,1]:=KG1[k] end do;
 

Please Wait...