Washing Machine drains during wash cycle
The drain hose is probably too low. The end of it has to be higher than the top of the wash drum (not the entire machine just the drum).

i.e. For a front loader this is the top of the drum, for a top loader this is the high water mark.