in islam every action is based upon it's intention. the consequence of the action is in accordance with the intention. there is no harm on you if you did something without knowing if it was a sin but we must also remember that ignorance is not an excuse for sinning. i will try to clarify in the light of authentic sunnah and quran,insha Allah.
Narrated 'Umar bin Al-Khattab:
I heard Allah's Messenger (ﷺ) saying, "The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended. So whoever emigrated for worldly benefits or for a woman to marry, his emigration was for what he emigrated for." [bukhari]
this hadith establishes the fact that what we intend is what matters. intentions itself are rewarded.
let us remind ourselves of these following verses from the quran just for a better understandind, insha Allah.
The repentance accepted by Allah is only for those who do wrong in ignorance [or carelessness] and then repent soon after. It is those to whom Allah will turn in forgiveness, and Allah is ever Knowing and Wise.[chapter 4 verse 17]
Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah. Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful."[chapter 39 verse 53]
it is incumbent upon you that as soon as you know it is a sin, to turn back to Allah and ask for fogiveness and insha Allah, you will be forgiven.
may Allah the mighty and sublime grant us mercy and guide us to the straight path.
Allah knows best.