Difference between the average operation and the application of the equivalent LPF
You are missing $1/N$ factor in your filter if you want to do a moving average.
Moreover, FIR filter has a group delay of $\frac{N-1}{2}$. So if N is odd the value of mean(data(1:N)) should be at the $\frac{N-1}{2}$ sample of the filter output