So you are not holding onto the pommel in walk? That is good.
When your horse is walking, can you feel how your hips move? First one of your hips should drop a little and then the other, alternately.
When your left hip drops, that means your horse has lifted it left hind leg off the ground.
Some people feel that doesnt make sense. A horse lifts its leg and your hip drops?
But think of the horse as an oblong table with a leg at each corner. If you remove one leg from the table, that corner of the table will no longer be supported , so that corner will drop. And as far as rider feel goes, that is what happens when a horse walks.
Breathe deep and relax and you should feel this side to side motion.
If you grasp the pommel too hard you may not feel your hips move. So loosen your hands jst a little and let the horse move your body. First left hip fall and then right hip.
Now the good news is that when the horse trots, the movement of its hind legs, first one side and then the other, is the same as in walk, just a bit faster and bumpier. So when you have the side to side movement OK in walk, try trotting, allowng your hips to rise and fall, just as you did in walk.
If you are on a trail ride, following another horse, it isnt always easy to slow down the trot. But to learn to sit the trot, it is a good idea to start the trot slowly, possibly in a private lesson. Western horses can usually do a very slow gentle jog trot which is even easier to sit and I was lucky to have a lesson like that in Texas,.
There are some horses (I ride one) on which it is not easy to sit the trot. They have quite a bumpy movement. So if you go on having problems, even with what I have explained, and have a teacher, it is worth asking them about the horse you are riding.