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

Hello,
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() {
onOffButtonState=digitalRead(onOffButton);
delay(1);
directionButtonState=digitalRead(directionButton);
motorSpeed=200;

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

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

if(motorEnabled==1){
analogWrite(HbridgeEnable, motorSpeed);}
else{
analogWrite(HbridgeEnable,0);}
previousDirectionButtonState=directionButtonState;
previousOnOffButtonState=onOffButtonState;
}

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.