Yes. Twitter was profitable in 2019. https://www.sec.gov/Archives/edgar/data/1418091/000141809120000037/twtr-20191231.htm
Ctrl+F for "Net Income", which will take you to the $1,465,659 (thousands) figure somewhere in its charts. Net Income is the bottom line: after all revenues, costs, etc. etc. of the year were added up.
Musk took it over with a so called "Leveraged Buyout", meaning Twitter borrowed $13 Billion to allow Elon Musk to buy it for $44 Billion (meaning Elon Musk only paid $33 Billion, the random +2 Billion to wipeout all the old debt).
Note that $13 Billion in loans costs somewhere between 10% to 14% right now, depending on how much of the loan was fixed and how much of it was adjustable. At 10%, this means that Twitter took on $1.3 Billion/year in interest payments as Elon Musk bought the company. There's pretty much no hope for Twitter to ever be profitable again, they'd have to execute as perfectly as 2019 despite losing 80% of their staff (Elon Musk also fired everyone when he took over the company).
The company was "barely profitable" in 2019, and "just barely losing money" in 2020, 2021. But add on a $1.3+ Billion/year loadstone, and its just... not... going to ever be profitable again.