There are two possible ways to answer this question.
First, let us look at the immediate purpose of this doctrine. Its immediate purpose was to prevent the Soviet Union from dominating the exit from the Black Sea into the Aegean Sea and, from there, into the Mediterranean Sea. The Soviets were pressuring Turkey to give them control of the Dardanelles and communists were fighting a civil war in Greece, which borders the Aegean. The US wanted to keep the Soviets hemmed in and unable to have free passage of their warships out of the Black Sea.
Second, we can look at the doctrine more as part of an overall strategy towards communism in general. This was the start of the policy of “containment.” The US did not want communism to spread out of Eastern Europe. The longer-term purpose of the doctrine was to establish the idea that the US would oppose communist efforts to spread their influence around the globe.
Thus, the Truman Doctrine can be said to have had both an immediate purpose and a purpose that was more long-term.
The Truman Doctrine aimed to combat the appeal of communism through the provision of military and economic aid. As a subset of the doctrine, the Marshall Plan had been formulated to aid in the efforts to contain the spread of Soviet influence. This was to be achieved through the establishment of economic ties and the development of interdependent economic bonds within Europe. It was through such relations that the Americans hoped to break any bonds the Eastern European states had with the USSR. American policy-makers also sought to use the economic recovery of the European states as an outlet for the excess industrial output that the US economy was generating as a result of the war efforts. The implementation of the Truman Doctrine thus sought to prevent the spread of greater Soviet influence in Europe.