Was the construction of the nylon string laid (i.e., twisted), braided, or kernmantle (braided sheath w/full-length filaments inside--like 550 paracord)? If laid construction, a square won't hold well at all; it's too slippery. Braided or kernmantle seem to hold better, though still can be slippery.
Try tying a figure-8 knot, instead. Even then, if space, usage, & cord permit, a couple of half-hitches on the free ends are a good idea.
I use braided nylon "accessory cord" for small lanyards, & have no problems if I use a figure-8 knot.
Good luck.
David