The derrailleurs are spring loaded and has a tendency to return to its original state. If the shifters are not held in place by friction or indexing (modern shifters) they will keep going back to the smallest gear.
If your pedalling hurts your knees, shift your gears to whear you can spin the crank easliy and try to maintian a high cadence vs mashing on your pedals with so much effort that i hurts your knees.