Maybe teaching you to suck eggs if so sorry
I seem to break more than my fair share of rear mechs on the trails so have replaced them more than I am happy with.
Make sure that the shifter is defiantly in top gear ( hit the trigger a load of times ) I have also trapped the cable in the with the maintenance stand on more than one occasion.
I set the limit screws without the chain on just push the mech for low gear and let it relax for high.
Set the adjuster on the shifter somewhere in the middle
Do up the cable, getting the tension here right here is the trick, no slack but no real tension.
Fit the chain if you have not done so
Run the through the gears on the work stand and use the adjuster on the shifter to tweak the changing.
I am not trained bike mech and there may well be a better way ( which I would be happy to learn )
Only once ( on someone else’s very old bike ) I have came across a broken shifter.