Ringgit ends lower on foreign fund selling