Displaying Coordinates in scene

Hi i want to create a function that when i click on a location or an objects on the terrain, i wanted the (coordinates) of it to be display on side of the scene,can some1 help me with it,currently i have this script which display coordinates on left button which outside scene,so how am suppose to do it?

function Update ()


if ( Input.GetMouseButton(0) )


  var hit : RaycastHit;

  var ray : Ray = Camera.main.ScreenPointToRay (Input.mousePosition);

  if (Physics.Raycast (ray, hit, 100.0))


     var hitPos : Vector3 = Camera.main.WorldToScreenPoint(hit.point);





private var hitPos : Vector3 ;
private var hitObjectPos : Vector3 ;
private var hit : RaycastHit ;

function Update(){

      var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition) ;
      if(Physics.Raycast(ray , hit)){
         hitPos = hit.point ;
         hitObjectPos = hit.transform.position ;

   //I guess you're wanting to use GUI to display this stuff??? 
   function OnGUI(){
       //The world position of the ray's contact point->
      GUI.Box(Rect(5,5,100,50), "Ray Hit Vector3 = " +hitPos) ;
      // The world position of the object the ray hits->
      GUI.Box(Rect(5,105,100,50), "Hit Object Vector3 = " +hitObjectPos) ;

Give that a shot, see if that's something like you're trying for.