Hi, in your screenshot, in the head section, delete lines 2,3 and the script code on lines 5-9. You do not put the script code in the head section.
Your code in the bottom section in the before body section, the code on lines 1-6 are ok. Delete the rest of the lines from lines 8 to the end of the before body section. You need to take those lines from line 8 to the end, and paste that into an HTML embed widget in the design mode of your site. So you just pick a place where you want the accordion to appear, and then past those div sections into an html embed widget on your page. Then after changes are automatically saved in design mode, publish your page and see how it looks...