You are creating the Map object outside the loop.
val map = HashMap()
So it will create single map entry where as you need different map for parent map.
Now you are entering different values in your map but since all maps references are now pointing to same Map Object so all Maps in your parent map will be showing last entries made to map.
The Solution is to keep val map = Hashmap() inside the loop. So with each iteration a different map objects will be created containg different data as per the iterations.