I had to do the motor rebuild recently - mine wouldn't engage, had the classic two clicks from the rear and no 4WD. I didn't have the problem you have so I'm guessing to a point.
When I removed the shift motor, the transfer case lever was pointed directly to "2H", which I expected since I knew I was in 2WD. I didn't apply any voltage to the motor, so I expected it would still be in 2WD when I reattached it to the transfer case. My impression from looking at the transfer case is that when you push the button for 4H, the motor rotates the lever to that point, and when you push the button for 4L, the motor rotates the lever even further to the 4L position. When you turn off 4L or 4WD, the motor rotates the lever back to the right spot.
1) Did you try disconnecting the battery? Your problem may have something to do with the position sensor "thinking" it's in the wrong position.
2) Does your 4WD light on the dash turn off? If you remove the motor from the case and push the dash button to turn 4WD off, at least in theory the motor (not the transfer case) should be positioned in the 2WD position. If you then manually reposition the transfer case lever to 2WD then reinstall the motor, everything should be lined up to be in 2WD, then when you push the button for 4H, the motor should only move to the 4H position. If you can't bolt the motor back to the transfer case because the lever and the motor are misaligned, you'll need to reposition the actuator so that the motor will bolt on.
If I remember correctly, 2H is at the 9 o'clock position. Mark your motor housing at 9:00 when it's still bolted to the transfer case so that you can see that the actuator is pointing to the right spot if you need to reposition it, then when you bolt everything together it should properly line up.
Did you disassemble the position sensor at all? If so, did you mark it? Maybe if that's off somehow, it could be causing your problems.
After you've made the adjustments, disconnect the battery for a minute. Many have noted that this helps the sensor figure out where it is.
When I did this job I was very careful to mark the alignment of everything before/as I disassembled so that things would be in the position when I reassembled it.
Hope this helps.
Longs