Soil doesn't behave like that when hit. We have craters, not cylindrical cavities all the way through when a meteor falls for example. In order to displace so much matter neatly, the amount of energy involved would probably be enough to turn the planet into plasma.
XKCD What If no. 20 is about how deep a 100-feet wide diamond meteor would penetrate the Earth. It has this quote:
Oddly, the speed that something is going doesn’t really affect how deeply it digs into the ground. Isaac Newton came up with a very clever idea for estimating how deeply projectiles will go in their targets before stopping. It turns out that no matter how fast a projectile is going, if it hits something that’s about the same density, it will only go about one body-length in.
So for an object to go through the Earth, it would need to be either as dense as a stellar core, or it would need to have a mass comparable to the Earth's. Even Mars-sized Theia, upon hitting Earth ~4 billion years ago didn't go all the way to the core of the Earth. An energy weapon (either using lasers, or electricity as in the question) would have to provide a similar amount of energy to obtain the same effect.
Let's assume that instead of smashing through the planet like that, the magic beam teleports away all matter in its path. This paragraph from L. Dutch's answer summarizes the result:
An end to end hole on Earth would not be stable, and would collapse under the gravitational force exerted by the planet. That would alone would release a large amount of energy which would surely evaporate the oceans if not even melt the crust.
The hole would not be stable exactly because of what gave the Earth its round shape. A prerequisite for a body to be a planet is for it to have enough self-gravity to overcome rigid body forces. In laysman terms, the magma/core material forming the walls of the hole won't be strong enough to keep the planet around it from collapsing into the hole. This collapse will dissipate vast amounts of energy.
I don't know how to calculate that energy, but I have an idea to approximate it. While the hole doesn't close, every point in the remaining Earth would have ~1.5m below it to fall onto. Of course they can't all fall 1.5m as they will crunch upon each other along the way, but the potential energy being turned into kinectic will be mostly the same.
That would be the equivalent to the mass of the Earth falling from a 3m height. So...
$$ mgh = (5.972 \times 10^{24}kg) \times (9.8m/s^2) \times (q.5m) = 8.8 \times 10^{25} j$$
Looking at this handy table tells us it's like the total energy output of the sun in half a second, or 50 times all the solar energy that Earth gets in one full year. It is also like being hit by the dinosaur killing asteroid five hundred times. You'll have that energy dissipated on the planet within a moment. That does not bode well to life.