Your computation of answer and the display are outside of the loop.
Just move them inside. Since "truth" does not change, but is used inside the loop, move it to the beginning.
a=input('value of a: ');
b=input('value of b: ');
truth=log(b)-log(a);
for n=4:2:20
answer=trap(a,b,n);
disp([n,answer,truth])
end
Alternatively, you could have generated the answer as an array, then displaying the entire set of results at the end.