You can't understand Daniel 9 unless you read Leviticus 26
Leviticus 26:40 If they shall confess their iniquity, and the iniquity of their fathers, with their trespass which they trespassed against me, and that also they have walked contrary unto me; 41 And that I also have walked contrary unto them, and have brought them into the land of their enemies; if then their uncircumcised hearts be humbled, and they then accept of the punishment of their iniquity: 42 Then will I remember my covenant with Jacob, and also my covenant with Isaac, and also my covenant with Abraham will I remember; and I will remember the land.
Compare this word in Leviticus 26 which follows God telling Israel how He will punish them with Daniel's prayer in Daniel 9.
Daniel 9:2 In the first year of his reign I Daniel understood by books the number of the years, whereof the word of the Lord came to Jeremiah the prophet, that he would accomplish seventy years in the desolations of Jerusalem.
Yes, Jeremiah says it will be 70 years, but Daniel understood how Jeremiah knew that because he looked at Leviticus which explains how God will punish Israel in the event they do not follow His ordinances and statutes.
3 And I set my face unto the Lord God, to seek by prayer and supplications, with fasting, and sackcloth, and ashes: 4 And I prayed unto the Lord my God, and made my confession, and said, O Lord, the great and dreadful God, keeping the covenant and mercy to them that love him, and to them that keep his commandments; 5 We have sinned, and have committed iniquity, and have done wickedly, and have rebelled, even by departing from thy precepts and from thy judgments: 6 Neither have we hearkened unto thy servants the prophets, which spake in thy name to our kings, our princes, and our fathers, and to all the people of the land. 7 O Lord, righteousness belongeth unto thee, but unto us confusion of faces, as at this day; to the men of Judah, and to the inhabitants of Jerusalem, and unto all Israel, that are near, and that are far off, through all the countries whither thou hast driven them, because of their trespass that they have trespassed against thee. 8 O Lord, to us belongeth confusion of face, to our kings, to our princes, and to our fathers, because we have sinned against thee. 9 To the Lord our God belong mercies and forgivenesses, though we have rebelled against him; 10 Neither have we obeyed the voice of the Lord our God, to walk in his laws, which he set before us by his servants the prophets. 11 Yea, all Israel have transgressed thy law, even by departing, that they might not obey thy voice; therefore the curse is poured upon us, and the oath that is written in the law of Moses the servant of God, because we have sinned against him. 12 And he hath confirmed his words, which he spake against us, and against our judges that judged us, by bringing upon us a great evil: for under the whole heaven hath not been done as hath been done upon Jerusalem. 13 As it is written in the law of Moses, all this evil is come upon us: yet made we not our prayer before the Lord our God, that we might turn from our iniquities, and understand thy truth.
Daniel prays according to the word of God and the law of Moses, particularly according to the word in Leviticus 26. He knew that Jeremiah had said seventy years but he didn't understand how he got that until he read Leviticus. Then in that chapter it also told him how to pray and this prayer is according to what Moses wrote in the law of Moses.
14 Therefore hath the Lord watched upon the evil, and brought it upon us: for the Lord our God is righteous in all his works which he doeth: for we obeyed not his voice. 15 And now, O Lord our God, that hast brought thy people forth out of the land of Egypt with a mighty hand, and hast gotten thee renown, as at this day; we have sinned, we have done wickedly. 16 O Lord, according to all thy righteousness, I beseech thee, let thine anger and thy fury be turned away from thy city Jerusalem, thy holy mountain: because for our sins, and for the iniquities of our fathers, Jerusalem and thy people are become a reproach to all that are about us. 17 Now therefore, O our God, hear the prayer of thy servant, and his supplications, and cause thy face to shine upon thy sanctuary that is desolate, for the Lord's sake.
When you are punished you need to understand why and you need to repent of that error. Then God can forgive you and bring you out.
18 O my God, incline thine ear, and hear; open thine eyes, and behold our desolations, and the city which is called by thy name: for we do not present our supplications before thee for our righteousnesses, but for thy great mercies. 19 O Lord, hear; O Lord, forgive; O Lord, hearken and do; defer not, for thine own sake, O my God: for thy city and thy people are called by thy name.
Learn of Daniel, this is how we can pray according to the will of God. Please notice he never blames Satan for the evil that has befallen Israel. Rather he confesses that the sins of Israel have brought this evil upon themselves and that this would never have happened had they simply hearkened to the word of God.