can anyone help me with equip/unequip a wepon?

hi guys please help me , i have a player when i press E key he equip the the weapon ,but i want when i press E key again yo unequip the weapon , and the weapon return to its original position on player “left upleg”

this is my script;
using UnityEngine;
using System.Collections;

public class WieldWeapon : MonoBehaviour
{

Animator anim;
public GameObject sword;

public GameObject hand;
void Start()
{

    anim = GetComponent<Animator>();

}

void Update()

{

    if (Input.GetKeyDown(KeyCode.E))
    {
        anim.SetTrigger("Draw");
        sword.transform.parent = hand.transform; //Parenting this item to the hand bone position
        sword.transform.localPosition = new Vector3(0.1170032f, -0.1580014f, 0.07697155f); // centering the sword handle
        sword.transform.localRotation = Quaternion.identity; //must point y local, so reset rotation
        sword.transform.localRotation = Quaternion.Euler(38.68549f, 13.8611f, 104.8913f); //and rotate the sword accordingly
    }

}

}

let us deal with press E key now use a bool variable :

bool equiped = false;
if (Input.GetKeyDown(KeyCode.E) && !equiped )
{
 //draw the sword
  equiped = true;
}
 else if  (Input.GetKeyDown(KeyCode.E) && equiped )
{
//hide the sword
equiped = false;
}

Could you do this using the new input system?