how to project point on plane in space

Hi, I am trying to project a point on a plane in space but I am getting a projected point on world space planes why ??
how do I get the coordinates of the point projected on the plane , or what is called the closest point from the plane to the target point?

Ok here is the code that should explain what needs to be done.

using UnityEngine;

public class PositionOnPlane : MonoBehaviour
{

    [SerializeField] Transform cube;
    [SerializeField] Transform sphere;

    [ContextMenu("Place")]
    void PositionObject()
    {
        Vector3 a = transform.position - cube.position; // distance and direction from cube to this transform
        Vector3 n = transform.up * -1; // Get inverse of normal

        float angle = Vector3.Angle(a.normalized, n); // get the angle between the two vectors

        // since that gives us a Hypotenuse and an angle we can solve for the adjacent
        // cos(θ) = adjacent / hypotenuse
        // cos(θ) * hypotenuse = adjacent

        float length2Plane = Mathf.Cos(angle * Mathf.Deg2Rad) * a.magnitude;

        sphere.position = cube.position + n * length2Plane;
    }
}