In my game I'm playing as a assassin rogue and I have just reached level three. My question is if I attack something in my understanding I get my assassination feature. If we then roll initiative and I go before it do I get the assassination again or am I misunderstanding it?
Assassinate, which gives you advantage on the attack roll, applies against any creature that has not had a turn in the combat.
You only roll initiative once, at the start of combat. So when it's your turn, you get that advantage against any creature that has not yet had its own turn.
If that creature is also surprised (was not previously aware of your presence) then the hit is automatically a critical (see Player's Handbook page 189).
You only benefit from Assassinate once per combat
You seem to be misunderstanding how surprise works. You cannot attack before rolling initiative. When combat is imminent, the GM decides who is surprised, and even if someone in the combat is surprised, you still roll initiative first.
The GM determines who might be surprised... If you’re surprised, you can’t move or take an action on your first turn of the combat, and you can’t take a reaction until that turn ends.
When combat starts, every participant makes a Dexterity check to determine their place in the initiative order.
Then during the turn where the creature is surprised, they still have a turn (they just can't act). This means that if you roll poorly on initiative, you may not get advantage from Assassinate even if they are surprised when combat starts (since they already had a turn):
You have advantage on attack rolls against any creature that hasn’t taken a turn in the combat yet.
It is generally understood (although not overwhelmingly clear), that a surprised creature ceases to be surprised when they take their first turn (even if they do nothing), so in order to benefit from Assassination you have to go before the target. They will not be surprised by the time your turn comes around so you don't get the guaranteed critical hit:
In addition, any hit you score against a creature that is surprised is a critical hit.