[Beginner] Why does the rigidbody not change its velocity when pressing space?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{

    private Rigidbody2D rb;
    private bool pressed;
    private bool movingLeft;
  
    
    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        rb.velocity = new Vector2(-3, 5);
        movingLeft = true;
    }

    void Update()
    {
        KeyboardInput();
        PlayerVelocity();
    }

    private void PlayerVelocity()
    {

        if (pressed && movingLeft)
        {
            rb.velocity = new Vector2(3, 5);
            movingLeft = false;
        }

        if (pressed && !movingLeft)
        {
            rb.velocity = new Vector2(-3, 5);
            movingLeft = true;
        }
    }

    private void KeyboardInput()
    {
        if (Input.GetKeyDown("space"))
        {
            pressed = true;
            pressed = false;
        }
    }
    
}

I want the player to start moving up left and then change moving up left or up right when pressing space. With my script, the rigidbody moves with the start velocity but doesn’t change its direction when pressing space. Why?

change the keyboardinput method to this

 private void KeyboardInput()
 {
     if (Input.GetKeyDown("space"))
     {
         pressed = true;
         movingLeft = !movingLeft;
     }
 }

Why making things complicated?

 void Update()
 {
     PlayerVelocity();
 }

 private void PlayerVelocity()
 {

     if ( Input.GetKeyDown("space") )
     {
         movingLeft = !movingLeft ;
         if( movingLeft )
             rb.velocity = new Vector2(-3, 5);
         else
             rb.velocity = new Vector2(3, 5);
     }
 }