Electron beam evolution and radio emission in the inhomogeneous solar corona