Need help with my 2d game Spawn object on mouse click

i need help making a script that spawns a prefab from the top of the screen, so it falls down and maybe hit an object. So far, i’ve got script that spawns the prefab and i’ve made it fall, but it spawns in the center of the screen. The prefab should be able to spawn at the top of the screen but in the same line as the mouse is on the screen (hope it makes sense)

I’m a newbie to unity and i’ve got the script from another post.

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

public class MouseClickFunction : MonoBehaviour {

    // Use this for initialization
    void Start () {
      
    }
  
    public GameObject balls;

    public void Update()
    {
        if (Input.GetButtonDown("Fire1"))
            PutBalls(Input.mousePosition);
    }

    public void PutBalls(Vector2 mousePosition)
    {
        RaycastHit hit = RayFromCamera(mousePosition, 1000.0f);
        GameObject.Instantiate(balls, hit.point, Quaternion.identity);
    }

    public RaycastHit RayFromCamera(Vector3 mousePosition, float rayLength)
    {
        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(mousePosition);
        Physics.Raycast(ray, out hit, rayLength);
        return hit;
    }
}

you need to modify you vector3 parameter for the instantiate with the Y position of the top of the screen. By the sounds of it, you only care what the x position of the mouse is.