The way you are using functions is very wrong. Functions should be at the top level, avoid nesting them under other events or conditions. Also, "Every X seconds" inside the function won't work.
And that chain of functions calling each other is completely unnecessary..
Say, you want to spawn a new wave of sharks every 2 seconds. And each wave should contain 5 more sharks. Then you can do something like this: