Why did Jews in the past deny and slay the prophets, for e.g. Isaiah, Zechariah, Uriah etc.? How did we get their books if they were killed?
True, Am Yisrael was at such a low level that they killed their prophets. Yeshayahu was killed by Menashe, the evil king, and Zecharia was killed in Beit Hamikdash and Am Yisrael was punished for this as seen in the Churban story in Gittin 57, and Yirmiahu grieve for that: "If a Cohen and prophet shall be killed in Mikdash Hashem". Regarding the writing of the prophecies it is written in Baba Batra 15 that Chizkia and his faction wrote Yeshayahu and Anshei Kenesset Hagdola wrote Trei Asar (including Zecharia). Rabbi Ro'i Margalit