You have a Kenmore belt drive washer, a platform that is no longer produced, but parts are widely available. There are magnetic coils mounted to the gearcase which control various actions in the washer. One operates agitation/spin action, and the other operates the pump. Your problem is some aspect of the pump action. The default position is for the pump to drain out. When the coil is energized, a lever moves and switches the mechanical pump into a different position, in which it doesn't pump out the water. So, what is probably hapenning is that one of the following is broken:
Wiring to the coil that operates the pump lever, check hot side and neutral side for breaks The coil itself, which operates pump pump lever position The plunger that is inside the coil The pump
My experience shows that the most common problem is the first one. Since default is for the pump to be in drain position, then once the washer goes from fill into agitation, then it will start to drain at the same time, and when the pressure switch sense lack of water, it will start to fill again. Once you fix the reason that the pump isn't switching to "maintain water" position, then it won't empty at the wrong times. If the problem is the wiring, then you can either fix the wire using your own supplies, or you can buy a nifty wire kit (IIRC, 285610) with wires ready to be spliced. Make sure that your connections are not near the coils, since there is a lot of movement in this area and connectors won't hold.