Double sided arow pattern too using while loop

main problem with this is in logic building so please explain it in most simple way using while loop only.
i dont understand too why we took nst or nsp =-1??
can u please give a briefing about nst or nsp=-1 too?