Suppose we have a theory. We use this theory to build devices, experimental tools etc. Some day we measure something that contradicts our theory. How can we say that the theory is disproved if the tools and devices we have used are based on the same theory? If our theory is wrong then wew can't say that we measured correct in order to disprove the theory.

Here is why.

Imagine for example a machine that uses gravity to make it run- like an overshot waterwheel that powers a grain mill. The person who built it in the 1300's had heard that Aristotle said this was because the natural location for things like rocks and water is on the ground, and the waterwheel works as intended so everything is OK.

Now comes Newton, and he furnishes a mathematical description of how masses attract, and then Cavendish does an experiment and determines the value of the constant G in Newton's equation. Aristotle's theory is thus shown to be completely wrong- but the waterwheel continues to work, and not only that, but the consequence is that we now have a tool that we can use to understand and predict the precise motion of planets in orbit around the sun. In almost every circumstance, those predictions comport exactly with experiment.

Then comes Einstein, and mathematically explains exactly why Newton's law must take the particular form that it does (and no other), and points out the special circumstances in which it will fail to yield the correct predictions, and thereby identifies why certain experiments yield results which do not fit Newton's model. The consequences of this are the prediction of black holes and gravitational waves, which neither Aristotle's nor Newton's models did- but waterwheels continue to work.

In the situation you describe, we do know that the theory is wrong: it predicted that a certain experiment would turn out a certain way, and it didn't. Now it could indeed be the case that the reason for this discrepancy is that the theory incorrectly analyzes the experiment in question so that it doesn't interact with the theory in the way we think, but this still constitutes an error in the theory.

Suppose a theory T predicts that (i) a certain experiment E will be a good way to measure the value of some constant a and that (ii) the value of that constant is 7. If we run E and get a vaue of 8, we don't know whether this is because a=8 or because E fails to pin down a, but we do know that T has made an error somewhere.

Now this does leave a real issue: just because we know that a theory can't be totally correct doesn't mean we know where exactly the error lies (or indeed how many errors there are), and getting more detailed information could be extremely hard. But we can be confident that something is wrong with T.

Of course, the above ignores the possibility of error in the experiment ("Steve drank the ferrofluid and replaced it with beer") or a theory which makes a statistical as opposed to absolute prediction ("We got three million, but our theory predicts an average value of negative two"). More subtly, we could have a theory which is very accurate within some appropriate domain; while we're certain that it's not fully correct, it's also too valuable to truly discard entirely (I've said a bit about this issue here). In practice, thoroughly refuting a theory is quite hard. So the above amounts to an analysis of an "ideal" situation.

`"We use this theory to build devices, experimental tools etc."`

Says who??? The >>design<< of a device is typically informed by a theory we want to test, but never (as far as I know) its >>construction<<.

For example, consider LIGO
https://www.ligo.caltech.edu/page/ligo-gw-interferometer
the well-publicized laser interferometer used to test general relativity's predictions about the existence of gravity waves. You don't use general relativity in the construction of lasers or of interferometers (indeed, you hardly ever (though not quite never) use general relativity in the construction of anything). LIGO's construction relies on the theories of optics, electricity and magnetism, quantum mechanics, a whole bunch of classical mechanics, and god knows what else. But not general relativity by any stretch of the imagination.

Thus, in this case, and in every other case I can think of offhand, the behavior of experimental apparatus used to test a theory in no way depends on the correctness of the particular theory being tested.

If you wanted to contest that claim, what immediately occurred to me was the Millikan (and Fletcher) oil drop experiment, e.g., https://courses.lumenlearning.com/introchem/chapter/millikans-oil-drop-experiment/ You're using electricity-and-magnetism devices (as well as gravity) to measure the charge of an electron. But the key piece of electrical equipment is the plates with a known potential difference between them. And that can be measured independently of the charge of individual electrons. So no harm, no foul.

But, yeah, if the construction of theory-testing apparatus depended on the correctness of the theory being tested, then your published paper would be followed by a slew of other papers pointing that out. But, nope, that just doesn't happen.