After adding mouse rotation, keys won't work

I have tried to script a plane for my game,
at first I gave it the ability to rotate left and right and go up and down and forward.
After that I have added a code for controlling the plane using the mouse, the code worked but none of the keys are working exept for W.

anyone have any idea how to make them work together?

here is the code:

	void Update () 
	{
		if (Input.GetKey (KeyCode.W))
			transform.Translate (-Vector3.forward * speed * Time.deltaTime);
		if (Input.GetKey (KeyCode.A))
			transform.Rotate (Vector3.forward, -turnSpeed * Time.deltaTime);
		if (Input.GetKey (KeyCode.D))
			transform.Rotate (-Vector3.back, turnSpeed * Time.deltaTime);
		if (Input.GetKey (KeyCode.Space))
			transform.Rotate (-Vector3.left, turnSpeed * Time.deltaTime);
		if (Input.GetKey (KeyCode.LeftShift))
			transform.Rotate (Vector3.left, turnSpeed * Time.deltaTime);
		XR += Input.GetAxis ("Mouse Y") * Sensitivity;
		YR += Input.GetAxis ("Mouse X") * Sensitivity;

		transform.rotation = Quaternion.Euler (XR, YR, 0);
	
	}

Yeah, your last line overwrites them with the XR and YR variables from the mouse. If you’d like to use both, you need to come up with a system that can blend the two methods or choose either/or. I can’t really suggest an exact solution without knowing the design you are trying to achieve.

transform.rotation = Quaternion.Euler (XR, YR, 0);

Sets the rotation directly using XR and YR, ignoring however you’ve rotated it before.

Instead of rotating directly with keyboard, you should modify the XR and YR from keyboard control. Something like:

    if (Input.GetKey (KeyCode.A))
         YR += -turnSpeed * Time.deltaTime;

etc.