The line in question comes from "The White Man's Burden," a poem that has gained considerable notoriety for its unabashed justification of Western imperialism. At the same time, one must recognize that, in writing the poem, Kipling was keen to stress the onerous responsibilities entailed by what he saw as the white man's great civilizing mission. It's a thankless task, says Kipling, addressing his audience of white imperialists; don't expect to receive much in the way of gratitude from the natives that you civilize:
Your new-caught sullen peoples, Half devil and half child.
The colonization of these dark and distant lands will not be easy, else it would be a delight and not a burden. Yet Kipling exhorts his audience to stick at it. One may have to endure years of thankless toil, but it'll be worth it in the end. Persistence will ultimately be rewarded with the admiration of one's peers.
Kipling is addressing his observations primarily to the United States government, inviting it to assume the same kind of responsibility for the Philippines—"take up the white man's burden"—as the British and other European colonial powers have done with their overseas territories. As a British citizen, Kipling feels that he speaks from a position of some authority, and is therefore entitled to advise the Americans as to the costs and rewards of the colonial enterprise.
In the final stanza of the poem, Kipling uses especially stirring rhetoric to drive his point home. The "thankless years" refer to the many years of struggle required to build a successful colony. Though undoubtedly a trying and difficult time, those years are valuable in that they provide a vital insight into colonial administration.
This is what Kipling means by "dear-bought wisdom;" European powers such as Great Britain now understand just what colonialism entails, but it took years of hard, practical experience before they were able to attain such knowledge. This "dear-bought wisdom" is "cold-edged," meaning that it is dispassionate, a kind of cold logic that doesn't take the feelings of the indigenous population into account. The rationality of the white man is subtly contrasted here with what Kipling would regard as the barbarism and superstition of the so-called lesser races.