need help with code for controlling a hydraulic press mode

Here's some points.
First of all, it's supposed to set you to do the research that you should have done earlier, now.

Second:
This is something that is told in about every post around here, where people are told how to use relays.
Because leaving those out will do serious damage sooner or later.

And last but not least:
You will remember this next time.

Research 'protection diode', using search function.