After pressing the Spawn button, How to use LMB to place objects at a certain position on the map?

What I wanted to do was after pressing the spawn button I can click anywhere else after that to specify where my object would spawn but the problem is that it doesn’t work with:

if(Input.GetMouseButtonDown(0))

Here’s my code for the GUI spawning

using UnityEngine;
using System.Collections;

public class myGUI : MonoBehaviour {
	RaycastHit hit;
	public GameObject prefab;
	int inc = 0;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		Ray ray = camera.ScreenPointToRay(Input.mousePosition);
		Debug.DrawRay(ray.origin, ray.direction * 100, Color.yellow);
		Physics.Raycast(ray, out hit, 100);
	}
	
	void Ispawn(){
		//Here I placed an increment so the spawn limit is 10
		if(inc < 10){
		//Here's where i stated where I want the object to spawn. Spawn location is where the mouse is.
		Instantiate(prefab, new Vector3(hit.point.x,hit.point.y,hit.point.z),Quaternion.identity);
		inc++;
		}
		
	}
	
	    void OnGUI() {

        //GUI.Box(new Rect(0, 0, Screen.width, Screen.height), "This is a title");
		
		// Make a background box
		GUI.Box (new Rect (10,10,100,90), "Spawn Menu");
		
		// Make the first button. If it is pressed, Application.Loadlevel (1) will be executed <- LIES 
		if (GUI.Button (new Rect (20,40,80,20), "Spawn")) {
			Ispawn();
		}

		// Make the second button.
		if (GUI.Button (new Rect (20,70,80,20), "Spawn 2")) {
		print("You press ME!");
		}
    }
}

So what Am I supposed to do?

It sounds like you want to enter a spawning state when the user clicks one of your GUI elements. You can track that with a bool or enum. In your update loop, if you are spawning, get a world position from the mouse (Camera.main.ScreenToWorldPoint(new Vector3(Input.Mouse.x, Input.Mouse.y, Camera.main.nearClipPlane))), and Instantiate your new game object there.

All I needed to do was make an offset as a boolean and I placed this in the update function:

		if((Input.GetMouseButtonDown(0)) && (Spawn == true) && (inc < 10)){
			Instantiate(prefab, new Vector3(hit.point.x,hit.point.y,hit.point.z),Quaternion.identity);
			inc++;
			Spawn = false;
			print ("Spawn is Now FALSE!");
		}