Since I have got help from here many times, now I will share the answer that I have found from a youtube video, below code basically do the trick :
% the little trick
K1=[1 2 ;3 4];
K=zeros(5);
for i=1:4
K(i:i+1,i:i+1)=K(i:i+1,i:i+1)+K1;
end
display(K)
It will display:
K =
1 2 0 0 0
3 5 2 0 0
0 3 5 2 0
0 0 3 5 2
0 0 0 3 4
This can be quite useful in FEA codes

