Do we take "The All Terminals" JFK AirTrain inside Terminal 4 or do we have to go outside and go through security again to get to Terminal 7?
From Terminal 4 to Terminal 7, you can take the first AirTrain that arrives, in either direction, but the The Jamaica/Howard Beach is quicker.
The AirTrain is outside the Terminal so you will have to leave the controlled area no matter what.
The All Terminals loop goes clockwise and is longer from T4 to T7. The Jamaica/Howard Beach trains go counter-clockwise and only stop at T5. There is no T6.
Since the AirTrain is outside the Terminal, you will have to pass through TSA once again at T7.
You have to leave the secure area of the airport to use the AirTrain, but not the building, so the answer is "yes" and "yes."