Since the cable seems to move when you shift, best guess is you simply don’t have enough tension. Its also possible that you did not have the shifter set in the correct setting when you attached the cable to the derailleur.
Suggest you start over. Disconnect the cable from the derailleur and turn the barrel adjuster back into the derailleur.Check to make sure the housing (outer covering, usually black, that the inner shifter cable runs through) is correctly seated in the shifter and all the cable stops along the frame. Check to make sure derailleur cage is aligned directly under the small cog of the cassette. If it is too far outboard turn the high limit screw in, if too far in, turn it counterclockwise. Reattach cable to the derailleur, pulling it as taught as you can as you tighten the bolt. Check shifting and adjust tension with barrel adjuster as needed to dial in shifting.