How to Stop a Function(Spawn Gameobject)

I have an object named shuriken and named box, box spawns a shuriken when its collider triggered by player. I used Insantiate function to spawn shuriken at any point, and I used InvokeRepeating function to spawn at sort of time interval and put it into Coroutine function. When player exits from box trigger the spawning still continue and if Player enters the trigger border again box spawns 2 shuriken now. Please help me to find the solution.

If i understand correctly you are starting Coroutine or InvokeRepeating when entering a trigger, if this is the case to stop spawning you have to on trigger exit stop Coroutine or InvokeRepeating by calling either StopAllCorutines() or StopCoroutine(yourCorutine) for coroutine or CancelInvoke(); for InvokeRepeating.