I screwed the top cap screw clockwise to remove play in the stem but I wonder if the stem has to be never moving or theres a point the headset is softly moving like rubber I assume bearing is still moving so what should I do of either of them?
When it's properly adjusted, there should be no perceptible play or movement.
Sometimes the above needs to be qualified that imprecision or imperfection in the parts can still allow some play, particularly under heavy load. Examples could be a cheap headset with an under-engineered plastic compression ring or an integrated headset headtube that's distorted such that the conical tapered faces don't work properly to remove play.
Threadless stems and spacers exist where the parallelism of the surfaces is bad enough to cause play, but that's not a common problem.
There should be zero headset bearing play. At the same time the handlebar/fork should turn freely. To check for play I find it easiest to put a hand around the headset area (i.e. grabbing both the stem/spacers and the frame) and feel for any play when you rock the bike back and forth.
Very bad cases of bearing play you can see and feel by pulling the front brake and rocking the bike back and forth.
You mentioned “screwing/tightening down the top cap,” which I am assuming to be a threadless steerer.
However, you did not mention that you loosened the bolts/screws that clamp the stem to the steerer tube. If you don’t loosen the clamping force of the stem to the steerer tube, tightening the top cap will have no effect. The top cap adjustment is to pre-load the bearings in the fork-headtube-stem-topcap “sandwich.” Once the play in the bearings is just removed while still retaining free flowing steering movement, you then tighten the screws that clamp the stem to the steerer tube to the torque spec. (with the stem aligned with the front wheel).
This adjustment sometimes takes a few tries to get it “just right.”
Weiwen suggested a link to describe preload, so if that could be helpful, you can find it here: Crank preload question and answer