Put 2 codes together! (School project)

Suppose that the clapper Arduino needed to turn an LED on when it detected a clap. Could you do that?

Could you connect a wire from the pin that the LED is/would connected to some pin on the other Arduino (with the ESP device on it), along with ground, of course?

Could you, on the server Arduino, read the state of that pin?

Maybe i can use the output from server(arduino) as an input to my arduino(clapper)?

Maybe, but it seems more likely that you want to use the output from the clapper as an input to the server.