The brown connector is main knock sensor connector and the black is the external wire you are referring.you just have to connect knock sensor wire to this black connector.
-------------
Remove the knock sensor wire harness (1) clip from the fuel rail stop bracket (2).
1 is the back connector, the external wire.
This is the knock sensor wire harness which is underneath the intake manifold.