Assume the following lemma:
Let $K$ be a compact subset of a smooth n-dimensional $\mathbb{R}$-manifold $M$ and $U$ an open subset of $M$ such that $K\subset U$. Then there exists a differentiable map $f:M\to \mathbb{R}$ with $f=1$ in $K$ and $f=0$ in $M-U$
Given $U$ open subset on $M$ and $X$ a smooth vector field on $U$. How can I get a smooth vector field $Y\in \mathfrak{X}(M)$ such that $Y_{|U}=X$?
No, take $M=S^1$, $U=M-point=(0,1)$ and a vector on $R$ such that $X(0)\neq X(1)$. Restrict $X$ to $(0,1)$.