Why cant clock be directly used instead of DQS in DDR during read and write
DQS is aligned with the data bus DQ, not the clock. It is used to precisely time where the DQ data are to be sampled. It’s a necessary complexity in order to support the clock speeds contemporary DDRx DRAM can achieve, in a way that supports a large number of chips and groups-of-chips (that is, ranks.)

DQS and DQ do have a rough alignment with the input clock, but this relationship isn’t tightly defined - certainly not well enough to achieve the timing accuracy needed to capture DQ correctly.

Instead, DQS and DQ are source-synchronous: they travel together from host to DRAM and vice-versa, and so have the same point-to-point delay. This applies in both directions: on writes the host drives DQ and DQS; on reads the DRAM chip drives them.

And it gets even more complicated. On writes, the host sends DQS phase shifted by 90 degrees and the DRAM catches DQ in the middle of its validity window. On reads, the DRAM sends DQS aligned with DQ, and the host phase-shifts DQS internally using a Delay Locked Loop (DLL) and captures DQ with that internal clock. In both cases the goal is the same: to get the best possible timing margin on DQ.