Apple Diagnostics is not designed for this purpose, and cannot prove your Mac is secure.
However, you should probably still assume you are safe from such a hardware-based attack.
It is important to note that Apple Diagnostics is a tool focused on testing hardware health, not focused on security assurance. So, we can assume that it isn't looking for things which it doesn't expect (within reason, I'm sure some aftermarket modifications that Apple dislikes would be found and flagged). Anybody with the resources for an attack like you describe — disassembling a MacBook Air, inserting a custom designed keylogger, and reassembling the machine — would have the resources to design it such that Apple Diagnostics wouldn't discover it.
But as the comment above by Stephen Touset points out, unless your threat model includes being targeted by some very well resourced attackers (clandestine services of nation states, elite private offensive security contractors, etc), whose attacks would include having undetected physical access to your computer, the risk of that kind of physical attack is insignificant. A MacBook Air is a particularly challenging target, as the interior of the machine is densely packed, difficult to access without leaving evidence, and generally just inaccessible.
Unless you have sincere, well-founded concern about the machine, hardware will not be the way you are attacked. Your risks are much more likely to be software-based attacks. And if you do have sincere, well-founded concern, then there's no way that a simple hardware diagnostics tool can ever prove the negative. In such a case, your only realistic option is to completely replace the unit with one that can't be linked to you (including being invoiced or delivered in your name or address, or being paid for by any method that can be connected to your identity or address).