I was in my attic today and I stepped on a cable and it snapped How do I fix this?
Unless you know exactly what you are doing, and it appears that you don't, then you will have to call an electrician.
Call a qualified electrican.
Call a professional. You could get hurt.
Just follow the National Electrical Code and it will tell you what rule's shall be followed. It is NOT a reference guide for amateurs, therefore, if you don't know what article the General Wiring Methods are off the top of your head, please do the responsible thing for you, your family AND your home by calling a professional electrician. THIS IS NOT FOR OUR GOOD. It is for your safety. Good luck in all you do and may God bless.
Get yourself an electrical box, some wire nuts, run each end of wire through knockouts on back of box, strip wire, wire nut back together, put a blank faceplate on and you up to code. 2 bucks for materials, an electrician will charge u fifty to do the same thing. Make sure you kill the powe first.