if i understood correctly then,
it is because your inner loop runs over j several times for each k value
hence in A the k position which you have given is overwritter for each j.
count = 1;
for j = 22:24
A(count,:) = (f1_lh_nwaer(j,25)+f1_lh_nwaer(j+1,25))/2;
count = count+1;
if this doesnt solves your query then please do explain your problem in other way as is it difficult to understand your current description of problem