While shifting with the engine doesn't normally hurt, it can.
In the future, if yo have the boat out of the water and on the trailer, don't shift with the drive all the way up. That just puts a lot of extra bend in the cable and makes it hard to shift.
Then, if it's sticking, just turn the props while shifting out of gear.
With the drive down and turning the props, it will shift like it was running.