A company that wants to run a natural gas pipeline through a Massachusetts state forest has agreed to pay $1.2 million for the right. The agreement announced Thursday settles a lawsuit brought by Tennessee Gas Pipeline Co., a subsidiary of Kinder Morgan.