Electron energy-loss spectroscopy study of electron-doping in MgB$_2$