See this piece of code:
f = exp(-(1/(2*h^2))*(l-x(i)).^2)/sqrt(2*pi)/h;
plot(l,f/(n*h));
In this f is a point and l is a vector. So in first place you are plotting point against a vector so it will be very difficult to see. Make fhat an array.
fhat(i)= fhat(i-1)+f/(n);
Note: I will strongly recommend you to see this link. Never plot anything inside for loop until it's very necessary to do that.