Npc enemy spawn outside of map

I added the teleport script to my npc and it worked but this always happens

If I understand correctly what you are trying to do, your problem is in this line:

transform.position = Vector3( Random.Range(spawnOrgin.x, maximum.x), Random.Range(spawnOrgin.y, maximum.y), Random.Range(spawnOrgin.z, maximum.z) ); // teleport 

It could be:

transform.position = Vector3( Random.Range(spawnOrgin.x-maximum.x, spawnOrgin.x+maximum.x), Random.Range(spawnOrgin.y-maximum.y, spawnOrgin.y+maximum.y), Random.Range(spawnOrgin.z-maximum.z, spawnOrgin.z+maximum.z) ); // teleport 

This will place an object within a rectangular volume centered at spawnOrigin.

Note if you can live with a sphere you can define the maximum as a float and then do:

transform.position = Random.insideUnitSphere * maximum;