The heated filament in a vacuum has a high pd applied between the filament and an anode so the filament acts as a cathode. The free electrons accelerate towards the anode, gaining kinetic energy. The electrons that align witht the hole in the anode pass through it, creating a beam of electrons with a specific kinetic energy