You don’t need to call this in main , implement and add it in your unit test as mentioned in testing examples on the same link.
TestNG Examples
Using ExtentTestNGReportBuilder
public class ExtentTestNGReportBuilder {
private static ExtentReports extent;
private static ThreadLocal parentTest = new ThreadLocal();
private static ThreadLocal test = new ThreadLocal();
@BeforeSuite
public void beforeSuite() {
extent = ExtentManager.createInstance("extent.html");
ExtentHtmlReporter htmlReporter = new ExtentHtmlReporter("extent.html");
extent.attachReporter(htmlReporter);
}