"And indeed, they were about to tempt you" meaning: they have indeed been about to tempt you "away from that which We have revealed to you" meaning: the Quran, "so that you might fabricate about Us other than it, and then they would have taken you as a friend" had you done that.
﴿وَإِن كَادُوا﴾ أَي: قد كَادُوا ﴿لَيَفْتِنُونَك﴾ أَيْ: يَسْتَزِلُّونَكَ ﴿عَنِ الَّذِي أَوْحَيْنَا إِلَيْك﴾ يَعْنِي: الْقُرْآنَ ﴿لِتَفْتَرِيَ عَلَيْنَا غَيْرَهُ وَإِذا لاتخذوك خَلِيلًا﴾ لَو فعلت ذَلِك