Answer: The Gemara (Shabbos 51a) teaches that the issur of hatmana, insulating foods on Shabbos, only applies to the pots in which the food was cooked, though not to any container into which the food is dispensed. As one knowingly cools the food by transferring the food, it is unlikely that one will then heat the food. Rashi explains that by transferring the food, one demonstrates that they don’t mind if the food loses a little bit of its heat. One would, therefore, be able to insulate the second container. Rambam (Shabbos 4:5) explains that chazal only prohibited insulating the food in the pot in which it was cooked. The Shulchan Aruch (OC 257:5) follows Rambam.
R’ Moshe Feinstein (Igros Moshe OC 1:95) writes that according to Rashi, one may not be allowed to transfer hot food into a thermos as one clearly does want to retain the heat. Nonetheless, as the Shulchan Aruch and others follow Rambam, one may use a thermos. Likewise, the Chazon Ish (Shabbos 37:32) and R’ Shlomo Zalman Auerbach (Minchas Shlomo 2:8:1) allow one to use a thermos flask writing that hatmana is specifically using towels and blankets, etc. to insulate. Accordingly, even Rashi would allow one to use a thermos flask.
R’ Ovadia Yosef (Yabia Omer OC 1:14) and R’ Eliezer Waldenberg (Tzitz Eliezer 11:29) quote R’ Shmuel Wosner who challenges the Chazon Ish, writing that he saw poskim who wouldn’t fill thermos flasks, though they both disagree with R’ Wosner’s challenge.
In conclusion, one may fill a thermos flask with hot water from a Shabbos kettle on Shabbos.