Moving an object where the mouse moves [C#]

Hi, i have a script where, when the user clicks on the button they can then click somewhere on the map and it will spawn the object at the point that the user clicks. I would however like to have it such that it spawns on the mouse position and then moves where the mouse moves. Here is the script:

using UnityEngine;
using System.Collections;

public class BuildingListAndSpawning : MonoBehaviour {

	public GameObject houseBasicFarm;
	bool spawnBasicHouseFarm = false;
	Ray ray;
	RaycastHit hit;
	GameObject instantiatedBasicHouseFarm;

	void Start(){



	}

	void Update(){

		if(Input.GetMouseButtonDown(0) && spawnBasicHouseFarm == true){

			ray = Camera.main.ScreenPointToRay(Input.mousePosition);

			spawnBasicHouseFarm = false;

			if(Physics.Raycast(ray, out hit, 100)){

				instantiatedBasicHouseFarm = Instantiate(houseBasicFarm, hit.point, Quaternion.identity) as GameObject;
				
			}
			
		}

	}

	void OnGUI(){

		GUI.Box (new Rect(Screen.width / 2 - 200, Screen.height / 2 + 200, 350, 60),"Buildings Available:");

		if (GUI.Button (new Rect (Screen.width / 2 - 190, Screen.height / 2 + 230, 160, 25), "House/Basic Farm")) {

			spawnBasicHouseFarm = true;

		}

	}

}

Hey,

it should work by this:

instantiatedBasicHouseFarm = Instantiate(houseBasicFarm, hit.point, Quaternion.identity) as GameObject;
	while(!placed)
	{  
		ray = Camera.main.ScreenPointToRay(Input.mousePosition);
		if (Physics.Raycast (ray, out hit, 1500)) 
		{    			
			transform.position = new Vector3 (hit.point.x, hit.point.y, hit.point.y);
		}
	}

Cheers