Does you laptop have the Butterfly mechanism or the Scissor mechanism? If you have the Butterfly mechanism and the white butterfly mechanism is detached from the keyboard, then it is impossible to reinstall it without damaging the laptop (even then the butterfly will probably not work correctly as it will be damaged). If any of the lugs on the butterfly mechanism are bent or damaged/missing, then you will need to have the whole Top Case/Keyboard Assembly replaced.
If you have a scissor mechanism and it is detached, then check to make sure the metal clips on the keyboard are straight and the lugs on the scissor are intact & straight as well. As long as the metal clips on the keyboard are Ok, it is possible to use a replacement scissor mechanism if the scissor is damaged.
On both types of keyboards if the plastic clips on the key cap are damaged (may even be slightly separated/widened), then the key cap will need to be replaced. The key caps have one side that must be installed first before snapping the other end of the key cap down. If the key has a stabilizer bar(s), then the key can be tricky to reinstall as you must align the stabilizer bar as well. If the clips for the stabilizer bar(s) on the key cap are damaged, then you will need to replace the key cap.
Replacing key caps can be very tricky with some keys being much more difficult.
FYI, an AASP is capable of purchasing a key cap kit from Apple, but the kit includes key caps for every key on the keyboard, so it will not be cheap. Sometimes it is possible to purchase a key cap online from a third party vendor, but you need to be very careful to get a key cap that matches the exact type of scissor mechanism (there may be several slightly different types) or butterfly. Some key caps may have a slightly different color of black and even a different style font on them.