What sealant to use on a hole in the interior of the house on an external wall?
Attempting to seal this from the inside probably won't work. If insects are getting through, there must be a gap in the exterior sheathing or framing. Closing off that one gap under the trim won't solve the problem as the insects will find another route, such as through the carpet. 

Find the opening on the outside and either repair the problem in the structure or use a combination of exterior caulk and spray foam, as needed. 

You might also treat the area outside the building with an insecticide.