The style here is rather out of date. Except as a period piece, no one writes like that currently. In fact, even when Treasure Island was first published in 1881, the style was old fashioned, because it was describing events set more than one hundred years before it was published, and the author attempted to evoke that period by his style.
"I take up may pen" means "I am starting to write this book". "The year of grace" means "the year AD" from the concept that these years were numbered from the birth of Jesus. The format "the year 17--" was commonly used, particularly in historical novels, to mean "a year in the 1700s, which i will not specify". The idea is that the narrator first wrote the full year, but then blanked out the last two digits. This avoids to close a connection with real history. Poe, in "The Murders in the Rue Morgue" used the same convention, as did many other authors. It was also common to use dashes to obscure the name of a fictional location (town or city or district) or of a fictional character, or of a real location or person used fictionally. This may have been to add an air of mystery, to avoid possible defamation claims, or to avoid critics pointing out inconsistencies.
In short
I take up my pen in the year of grace 17—
means "I start to write this book in an unspecified year in the 1700s." The events presumably would have occurred some years earlier -- the narrator is writing his account well after the (supposed) facts.