I had an 18hp evinrude that wont shift in forward and when it would shift, it wouldnt stay. The shifter level on the side of the motor has an adjustment bolt on it. I loosen it up and adjusted the level. Worked great after that. May not be your problem but worth checking into.
Do you have reverse?