The easiest way to get a derailleur limit setup is to de-cable the derailleur, and back both screws all the way out.
Then the derailleur spring will bring the chain all the way to the highest gear (smallest cassette cog), and since you backed the limit screw out, the chain will want to rub against the frame stays.
Use your fingers to push the derailleur up into a lower gear and then turn the limit screw for the outside limit one full turn. Repeat this until without using your hand to guide the derailleur the chain rests in the highest gear without needing any force, but also doesn't rub against the frame stay.
Then use your hand to push the derailleur all the way to the lowest gear (largest cassette cog) and try to get the chain to fall between the cassette and the wheel spokes. If it can fall over the inside of the gear and into the spokes then turn the limit screw for the inside limit one full turn. Repeat until the chain can reach the lowest gear without using excessive force, but cannot fall off the cog toward the spokes.
Add some lock tight to both limit screws so that you don't have to adjust them again, and you are done!
Now just reattach the rear derailleur cable and adjust the tension if you need to.