Control linear actuator forward/backward with button switches and H -Bridge

I have a linear actuator Actuonix L16-12V option P, which changes direction by changing the polarity
I just need to manually activate it and decide to move it forward or backward through a button switch and the H-bridge motor driver L293D of the Arduino Uno kit. (yes, not the best motor driver, but it is just for starting)

I do not care about speed; I would use button switches to activate and direct it, but it does not care about them, and, asap as I upload the sketch, it just moves in one direction and tries to keep moving when reached the end. actuator 3
The actuator has 5 cables and I am just using the red and black (motor V+ and V-). Maybe this is a wrong idea.

The code comes from the Ex 10 of the official Arduino Project book, which uses the HBridge, 2 buttons, and a potentiometer to control a rotating DC motor. Maybe this is wrong.

I do not know where the error could be and such any help would be appreciated!

const int Hbridge7 = 2;
const int Hbridge2 = 3;
const int HbridgeEnable=9;
const int directionButton =4;
const int onOffButton =5;
// const int pot=A0; I skipped the potentiometer and speed regulations

int onOffButtonState=0;
int previousOnOffButtonState=0;
int directionButtonState=0;
int previousDirectionButtonState=0;

int motorEnabled=0;
int motorSpeed=0;
int motorDirection =1;

void setup() {
// put your setup code here, to run once:
pinMode(directionButton, INPUT_PULLUP);
pinMode(onOffButton, INPUT_PULLUP);
pinMode(Hbridge7, OUTPUT);
pinMode(Hbridge2, OUTPUT);
pinMode(HbridgeEnable, OUTPUT);
digitalWrite(HbridgeEnable, LOW);

void loop() {

if(onOffButtonState != previousOnOffButtonState){
if(onOffButtonState ==HIGH){
if(directionButtonState != previousDirectionButtonState){
if(directionButtonState ==HIGH){
digitalWrite(Hbridge7, HIGH);
digitalWrite(Hbridge2, LOW);}

digitalWrite(Hbridge7, LOW);
digitalWrite(Hbridge2, HIGH);}

analogWrite(HbridgeEnable, motorSpeed);}

Beside the fact that you don’t use the potentiometer feedback lines, you also use int variables instead of bool

The directionButtonState needs three states: forward, stop, backward.
Also the buttons you read are not debounced which can cause a lot of trouble.

IMHO the actuator can only be used in a closed loop fashion, which includes reading the potmeter input.