Suppose $Hg(A=197)$ decays to $Au(A=197)$ by electron capture and assume that electron is captured from $K$-shell and an x-ray is emitted. Is the electron captured from $Hg$ or $Au$? I am confused in using the Mosley's equation. Shall I use $Z=79$ or $80$.
The X-ray which is emitted by electron capture is not the same as the X-ray which Moseley's law assumes.
The X-ray emitted because of an electron capture is not related to Moseley's law. An electron capture is said to have happened when a proton-rich nucleus absorbs an electron. During this process, a proton converts to a neutron along with the production of other particles. This usually leaves the nucleus in an excited state. The excited nucleus goes to the ground state by emitting a photon (usually a gamma ray).
Moseley's law takes about the line spectrum. The X-rays which are emitted due to the electrons jumping between energy levels.
In your case, Moseley's law is not applicable.