If you find anything incorrect or you feel that there is any better approach to solve the above problem, please write comment.
__________________________________________________

There is one more little easy solution of the problem-:
private void swap(Node head,int k) {
if(head==null || k<2){
return;
}
int i = 2;
Node first = head;
Node second = null;
Node curr = head.next;
while (curr != null) {
if (i % k == 0) {
second = curr;
int temp = first.data;
first.data = second.data;
second.data = temp;
first = second.next;
}
curr=curr.next;
i++;
}