"How come knowledged persons like bhisma,drona and karna lived a life knowing that the liberation is the life's goal and didn't live according to it"
Among these, 2 were liberated (attained Moksha) according to scriptures.
- Drona's liberation: Before being beheaded by Dhrishtadyumna, Drona engaged himself in Kriya yoga, described in Gita (BG 4.29, 5.27-28), and left his mortal body to attain the supreme. Here is another related post - What were the actions of the illustrious Dronacharya, immediately before quitting his material body?:
As regards Drona himself, abandoning his weapons, he was then in a supremely tranquil state. Having said those words he had devoted himself to Yoga. Endued with great effulgence and possessed of high ascetic merit, he had fixed his heart on that Supreme and Ancient Being, viz., Vishnu. Bending his face slightly down, and heaving his breast forward, and closing his eyes, and resting on the quality of goodness, and disposing his heart to contemplation, and thinking on the monosyllable Om, representing. Brahma, and remembering the puissant, supreme, and indestructible God of gods, the radiant Drona or high ascetic merit, the preceptor (of the Kurus and the Pandavas) repaired to heaven that is so difficult of being attained even by the pious. ... Only we five ... could see that glory of the wise Drona, devoted to Yoga, while passing out of the world. In fact, all human beings were unconscious of the fact that the preceptor attained to the supreme region of Brahman, a region mysterious to the very gods, and one that is the highest of all.
- Bhishma's liberation: Before leaving his own wounded body with arrows, Bhishma praised Krishna with full devotion. Constantly engaged & concentrated in Krishna's consciousness, Bhishma left his mortal body. According to Gita, BG 8.5 - "those who die thinking of only 'Me', attain 'My' nature". Hence Bhishma also attained Moksha with the path of DhyAna:
Having uttered these words, Bhishma, with mind concentrated upon Krishna, said, 'Salutations to Krishna!' and bowed unto him. Learning by his Yoga prowess of the devotion of Bhishma, Madhava, otherwise called Hari, [entering his body] bestowed upon him heavenly knowledge compassing the Past, the Present, and the Future, and went away. When Bhishma became silent, those utterers of Brahma (that sat around him), with voices choked in tears, adored that high-souled chief of the Kurus in excellent words.
Also refer this answer, which explains on how Bhishma waited till the right fortnight to attain Moksha.
- Karna's death: Karna was part of Sun in form of mortal body. When he died, he again merged back to the consciousness of sun & didn't return to earth. Hence when the Sun (or Surya deva) gets Moksha, Karna will also get Moksha. There are multiple examples of amalgamation and redistribution of consciousness from 1 to many bodies and many bodies to 1, which I tried to discuss in this post - Is there a possibility of GRADUAL conversion of "Purusha" to "Jeeva-s" and similar gradual return?:
Thus cut off with that Anjalika, the trunk of Karna fell down on the earth. The head also of that commander of the (Kaurava) army, endued with splendour equal to that of the risen sun and resembling the meridian sun of autumn, fell down on the earth like the sun of bloody disc dropped down from the Asta hills. Indeed, that head abandoned with great unwillingness the body, exceedingly beautiful and always nursed in luxury, of Karna of noble deeds, like an owner abandoning with great unwillingness his commodious mansion filled with great wealth. Cut off with Arjuna's arrow, and deprived of life, the tall trunk of Karna endued with great splendour, with blood issuing from every wound, fell down like the thunder-riven summit of a mountain of red chalk with crimson streams running down its sides after a shower. Then from that body of the fallen Karna a light passing through the welkin penetrated the sun.
"Or didn't they know that liberation is the goal of life"
This cannot be answered definitively. IMO, people during MahAbhArata times were well aware of ultimate liberation. The awareness about liberation is quite ancient, which is re-described in Gita and other scriptures. We can very well expect that the awareness of liberation will retain itself in future as well.
In Gita, certain phsyical signs of Moksha are mentioned.
Very few among humans attempt to attain the supreme in its actual form [BG 7.3]. But with amalgamation of consciousnesses, everything ultimately gets liberated [BG 9.7]. For example, people with Sattva, choose various celestial forms (Deva), people with Rajas choose various attached forms (Humans, Raksha, Yaksha), people with Tamas choose various lower forms (Bhuta-Preta, Animals).