How could Prophet Daniel have done prophecy for the Persian kings, in exile, because I heard prophets of Israel could only do prophecy in the land of Israel
Daniel is in Kesuvim because it is not prophecy. There is a machlokes as to whether Daniel was or was not a prophet. However, we see that Baruch ben Neriyah (Yirmiyahu's student) never became a prophet because he went into exile before he became one (Yirmiyaho 45:3). We also see that Yechezkel (chapter 24) was given when he was already in Bavel.
The point is that a person could only be appointed a prophet in Eretz Yisrael (Yona), but that once he has been established as a prophet (Yechezkel) he can be given the information to tell the other people.
Whether or not Daniel was a prophet, the information that he gave Nevuchadnetzar was via Ruach Hakodesh which is a lower lever of interaction with Hashem than nevuah (prophesy).
On the one hand, the Talmud does explicitly state that Daniel was not a prophet.1 On the other hand, when the Talmud states that only “48 prophets and 7 prophetesses prophesied to Israel,”2 the sages disagree as to whether Daniel is included in that list or not.3
What is even stranger is that the remark in the Talmud that Daniel was not a prophet is made in connection with an incident in which Daniel seems to have seen a vision, when the three official prophets who were with him did not: 
.Talmud, Megillah 3a.
. Ibid., 14a. It should be noted that when the Talmud states that only 55 prophets “prophesied to Israel,” it does not mean that there were only 55 prophets. In fact, the Talmud there tells us that the number of prophets throughout Jewish history was double the number of people who left Egypt. What it means to say is that there were 55 prophets who said prophecies that have relevance for future generations and not just for their own generation.
. See Halachot Gedolot, ch. 76; Seder Olam Rabbah, ch. 20; commentary of Rabbi Shlomo Yitzchaki, Rashi to Megillah, ibid.
. Daniel 10:7.
Those who have ruach ha-kodesh, however, feel as if the divine spirit came upon them. With it they receive a new power that encourages them either to take a specific action, speak wisdom, compose hymns, exhort their fellow men or discuss political or theological problems. All this is done while the one with ruach ha-kodesh is in full possession of his or her senses.10
The experience of Ruach Hakodesh is different from that of nevuah and is on a different level.
It is true that the inspiration may sometimes come in the form of a dream, as it does with prophets. There is, however, a difference between the visions experienced by prophets in a dream and those that come through ruach ha-kodesh, as was the case with Daniel.
The difference can be seen in how prophets and those inspired by ruach ha-kodesh refer to their visions and dreams. When prophets prophesy, they are informed that the vision was a prophecy, and upon awaking, they state decidedly that it was a prophetic experience