Tolkien used a number of similar roots as the basis for “line” words throughout his life. The earliest of these appeared in the Qenya Lexicon as ᴱ√TEHE [teχe] “pull” (gloss marked with a “?” by Tolkien) with derivatives like ᴱQ. tea “straight”, ᴱQ. telya “attractive; importunate”, and ᴱQ. tie “line, direction, route, road” (QL/90), the last of these surviving more or less unchanged all the way into the published version of The Lord of the Rings (LotR/377). The early root ᴱ√TEHE also had derivatives in the contemporaneous Gnomish Lexicon such as G. tê “mark, line; track; path”, G. tî or tion “straight”, and G. tîr “honest; esteem, regard, honour”, originally “straight, upright” (GL/69, 71). Primitive ᴱ✶tegna > ᴱQ. tína/ᴱN. tain “straight” from Early Noldorin Word-lists from the 1920s may represent a shift in the form of the root to ✱ᴱ√TEGE (PE13/153, 165).
In The Etymologies of the 1930s the root appeared as {ᴹ√TEƷ >>} ᴹ√TEÑ “line, direction” with derivatives like ᴹQ. tie/N. tê “line, way” and ᴹQ. téra/N. tîr “straight, right” (Ety/TEƷ, TEÑ). In the Outline of Phonology Tolkien gave √TEG “line”, whereas √TEÑ was given as the basis for Q. tenna “a thought, notion, idea” and thus clearly with a different meaning; see the entry √TEÑ for further discussion. In any case it is clear that Tolkien considered various ancient velar consonants for the second consonant of this root, all ultimately vanishing in the child languages with similar vocalic effects: 1910s teχ-, 1920s teg-, 1930s {teʒ- >>} teñ- and 1950s teg-.
Neo-Quenya: For purposes of Neo-Eldarin, I would assume this root was √TEƷ in order to preserve the validity of the word téma “series”. This is because Tolkien kept vacillating on the development of gm, but usually had gm > ngw, so that teg-mā > tengwa, not téma.
The first mention of this root was as ᴱ√TEŊE “know, understand” in the Qenya Lexicon of the 1910s where it had derivatives like ᴱQ. tenge- “know, understand, grasp” and ᴱQ. tengwe “knowledge, understanding” (QL/91). In The Etymologies of the 1930s, Tolkien instead gave {ᴹ√TEƷ >>} ᴹ√TEÑ “line, direction” with derivatives like ᴹQ. tie/N. tê “line, way” and ᴹQ. téra/N. tîr “straight, right” (Ety/TEƷ, TEÑ). However, in the original layer of composition for the Outline of Phonology (OP2) from the early 1950s, Tolkien gave √TEG for “line” and gave √TEÑ as the basis for Q. tenna “thought, notion, idea”, perhaps a restoration of its meaning from the 1910s (PE19/97).
In another entry in The Etymologies of the 1930s, Tolkien derived ᴹQ. tengwa from ᴹ✶tekmā = ᴹ√TEK “write” + the instrumental suffix ᴹ✶-mā (Ety/TEK). The foundation of this derivation is the sound change whereby voiceless stops were voiced before nasals in Ancient Quenya, thereafter nasalizing so that ᴹ✶tekmā > tegmā > teñmā > teñgwā (PE19/43). This sound change was still in effect when Tolkien wrote the initial draft of Outline of Phonology (OP2) in the early 1950s (PE19/85-66 note #79), but at some later point Tolkien revised this rule so that the nasal instead unvoiced, so that km > kʰm̌ > kƕ > kw (PE19/85), making the derivation of tengwa from the root √TEK invalid.
As pointed out by Christopher Gilson (ibid., note #79), earlier signs of this new phonetic rule can be seen Tolkien’s notes on Words, Phrases and Passages in the Lord of the Rings from the late 1950s, where he gave √TEÑ “show, sign, indicate” instead of √TEK “[written] sign” as the new root for Q. tengwa, now derived from ✶teñwā or ✶teñmā, though Tolkien briefly considered √TEWE as a possible root in drafts to these notes (PE17/44). From this point forward, Tolkien regularly mentioned √TEÑ with glosses like “indicate, signify” (WJ/394), “represent, betoken, indicate (by sign)” (VT39/15) and “indicate, mark, signify” (PE22/149). Finally, in green-ink revisions to OP2 from 1970, Tolkien added tengwa as another derivative of √TEÑ alongside Q. tenna “thought, notion, idea” as mentioned above (PE19/97 and note #139).
See the entries on √TEG “line” and √TEK “write” for parallel developments in similar roots.