As the question title says I would like to read references from some authentic resources (scriptures, if possible) about the story behind the legendary temple of the virgin Goddess, Kanya Kumari, like who constructed it and for what purpose?
As per the Sthalapurana of Kanyakumari,
Protected by a boon that he could only be killed by a virgin girl, Banasura was wreaking havoc, driving the devas away from heaven and torturing the saints and sages. Unable to bear the agony of her children, Bhoomi Devi [Mother Earth], sought the help of Lord Vishnu, the Protector of the Universe. Vishnu advised that the devas should supplicate themselves to Parashakti, the Divine Mother, as she alone was capable of vanquishing Banasura.
Accordingly, the devas performed a yajña [Vedic sacrifice involving a fire pit] in supplication for the Parashakti’s help. Parashakti appeared before them in the form of small girl and promised to annihilate the evil forces championed by Banasura. Asking the devas to be patient for the right time for the killing of Banasura, Parashakti then came out of the fire and travelled to the southern-most tip of India, where she began to meditate upon Lord Shiva. As time went on she grew into a teenager. This is how the southern tip of India got the name Kanya Kumari, as kanya kumari means “a virgin teenaged girl.”
Seeing Parashakti in the beautiful form of Kanya Kumari, Lord Shiva fell in love [specifically the form of Lord Shiva worshipped in Suchindram, a town 15 km from India’s southern tip.] Parashakti agreed to become his bride, and arrangements were made for their marriage.
At this point, the divine sage Narada realized that the marriage of Lord Shiva with Kanya Kumari would destroy the goddess’ chances of destroying Banasura, as he could not be killed by a married woman. In order to prevent this potential disaster, Narada decided to sabotage the holy couple’s wedding.
The marriage was to take place at midnight on a certain auspicious day. On that day, Lord Shiva began his journey from Suchindram to Kanya Kumari’s abode. When he was in the town of Vazhukkamparai [5 km from Suchindarm], Narada assumed the form of a rooster and crowed, falsely heralding the break of dawn. Thinking that he had missed the appointed hour of his marriage, Shiva returned to Suchindram.
It is said that in Kanya Kumari’s anger over Shiva not arriving that she scattered all the food items that had been assembled for the wedding. The small pebbles, resembling sand, and the multi-coloured sands found on the shore in southern India are attributed to the above incident.
Soon Banasura heard about Kanya Kumari’s beauty. He decided that he would come and try her hand in marriage. She refused him. In rage, the demon decided he would take her by force. He drew his sword, but Kanya Kumari was also armed. A fierce battle took place, which ended with Kanya Kumari slaying Banasura with her chakra [divine discus] in Mahadana Puram [4 km north of Kanya Kumari].
It is said that at the moment of his death, Banasura repented for his adharmic acts and prayed to Parashakti to have compassion upon him and absolve him and anyone else who bathed in the waters off Kanya Kumari of their sins. Devi granted Banasura the boon, and this is why people come from all over the world to bathe in this holy confluence of seas.
According to the temple’s sthala purana, the idol was installed by Lord Parasurama, an incarnation of Lord Vishnu. One specialty of the idol is her diamond nose ring, which sparkles gloriously. The temple’s legend says that the nose ring was obtained from a king cobra and that light reflects off it so brightly that once an ancient mariner mistook it for a lighthouse. Sailing his ship towards the beacon, he wrecked upon the Kanya Kumari rocks. In order to prevent such a tragedy from happening again, the eastern door to the temple’s sanctum sanctorum is only opened on five special occasions throughout the year.
Today's temple is belived to be renovated by one of the kings of Pandya Dynasty.
The above stroy is mentioned in reaserch works like Heritage Of The Tamils Temple Arts: 19. Temples in Kanyakumari District mention
The legends concerning the temples of both Suchindrum and Kanyakumari bear a close inter connection. That the God at Suchindrum sought the hand of the Virgin Goddess at Kanyakumari is a matter of common Tradition.
At Kanyakumari, Devi Parasakthi is said to have annihilated Banasura.
Goddess Kanyakumari is being worshipped from very early days even before the birth of Christ. The three Tamil kings, Chera, Cola and Pandya, worshipped Devi Kanyakumari. The Goddess has shown divine path to Swami Vivekananda who has proclaimed India's culture to the whole world. Mahatma Gandhi has revered Devi Kanyakumari.