raycasting direction

i m making a game in which i have instantiate a gameobject at run time through raycasting ,but how could i instantiate game object on the direction where i click the mouse button , i want the gameobject get instantiate according to the direction where mouse button get clicked…
thankz in advance

here is my code

var cylinder :GameObject;

function Update () 
    transform.position.x +=0.003;
    var hit : RaycastHit;

    if (Input.GetMouseButtonDown(0)) 
        if (Physics.Raycast (transform.position,transform.forward,hit, 1000)) 
                 Instantiate (cylinder ,transform.position, Quaternion.Euler(90,90,90)); 

Use RaycastHit to know where the ray hit. Then instantiate your object there.

You could spawn the object at the hit.point, rather than transform.position, as that would make it spawn at the scripts gameobjects position. You also have to make sure you have a plane with a collider on or something so the ray hits something.

To get it to raycast to the point position, you can use Camera.ScreenPointToRay and put the Input.mousePosition into it and use the returned Ray class in the Raycast function.