The devil hated you the moment you were conceived in your mother's womb because he hates everything God loves, and God loves you. In the garden of Eden that serpent tricked Adam and Eve into disobedience, but now we can have victory through Jesus Christ our Lord. Jesus said the devil's only purpose is to "steal, kill, and destroy." (John 10:10)
To get the devil to leave you alone, you have to follow Jesus' example. When He was tempted in the wilderness, Jesus said several times, "It is written". So, that's all we need to do: quote the Word of God. Another name for the Word of God is the "Sword of the Spirit". If you don't give up, and keep using that sword against him, he will leave. That's what happened to Jesus, and that's what will happen to you.
Once you've won the victory, you will know how to fight him when he comes around again, and you'll also be able to help others in their time of need. At the end of the temptations of Jesus, it says the devil left Him "for a season". In other words, the enemy planned to come back later. Just remember: Use the Word of God against him, and you will win every battle every time.
Below I have a quote I encourage you to say as often as you like, but especially when you're being attacked by the enemy:
I refuse to give the devil any place in my life, and I will set no wicked thing before mine eyes. I abstain from all appearance of evil, and there shall no evil befall me, neither shall any plague come nigh my dwelling.
I resist the devil, and he flees from me. The devil flees from me because I resist him in the name of Jesus. Jesus said, "Behold, I give unto you power to tread on serpents and scorpions, and over all the power of the enemy, and nothing shall by any means hurt you."