Don’t edit the files. There are many Widget Areas you could use to add your ads. You could add your ad codes on a Text Widget then place them on the Post – Before Content and Post – After Content widget areas. You can use Widget Logic plugin so that the widget would only appear on Posts and not on Pages. Using
!is_page() means the widget will show on any article that is not a Page type.